Return-Path: X-Original-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-ooo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7AEDA825D for ; Tue, 9 Aug 2011 00:21:29 +0000 (UTC) Received: (qmail 63035 invoked by uid 500); 9 Aug 2011 00:21:29 -0000 Delivered-To: apmail-incubator-ooo-commits-archive@incubator.apache.org Received: (qmail 62961 invoked by uid 500); 9 Aug 2011 00:21:28 -0000 Mailing-List: contact ooo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ooo-dev@incubator.apache.org Delivered-To: mailing list ooo-commits@incubator.apache.org Received: (qmail 62951 invoked by uid 99); 9 Aug 2011 00:21:28 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Aug 2011 00:21:28 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 09 Aug 2011 00:21:25 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id C7E9A23888CC; Tue, 9 Aug 2011 00:21:05 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1155167 - in /incubator/ooo/site/trunk/lib: path.pm view.pm Date: Tue, 09 Aug 2011 00:21:05 -0000 To: ooo-commits@incubator.apache.org From: wave@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110809002105.C7E9A23888CC@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: wave Date: Tue Aug 9 00:21:05 2011 New Revision: 1155167 URL: http://svn.apache.org/viewvc?rev=1155167&view=rev Log: Updated view.pm to add html_page wrapping, sidenav turn off and alternative javascript and css insertion. Minor titling change. Added html_page.html pattern to path.pm. Modified: incubator/ooo/site/trunk/lib/path.pm incubator/ooo/site/trunk/lib/view.pm Modified: incubator/ooo/site/trunk/lib/path.pm URL: http://svn.apache.org/viewvc/incubator/ooo/site/trunk/lib/path.pm?rev=1155167&r1=1155166&r2=1155167&view=diff ============================================================================== --- incubator/ooo/site/trunk/lib/path.pm (original) +++ incubator/ooo/site/trunk/lib/path.pm Tue Aug 9 00:21:05 2011 @@ -4,6 +4,7 @@ package path; our @patterns = ( [qr!\.mdtext$!, single_narrative => { template => "single_narrative.html" }], + [qr!\.html$!, html_page => { template => "html_page.html" }], ) ; # for specifying interdependencies between files Modified: incubator/ooo/site/trunk/lib/view.pm URL: http://svn.apache.org/viewvc/incubator/ooo/site/trunk/lib/view.pm?rev=1155167&r1=1155166&r2=1155167&view=diff ============================================================================== --- incubator/ooo/site/trunk/lib/view.pm (original) +++ incubator/ooo/site/trunk/lib/view.pm Tue Aug 9 00:21:05 2011 @@ -26,6 +26,7 @@ push our @TEMPLATE_DIRS, "templates"; sub single_narrative { my %args = @_; + my %styleargs = @_; my $file = "content$args{path}"; my $template = $args{template}; $args{path} =~ s/\.mdtext$/\.html/; @@ -42,8 +43,16 @@ sub single_narrative { read_text_file $f, $args{$1}; } } - + $args{content} = sort_tables($args{content}); + $args{sidenav} = 1; + + my $style_path = $file; + $style_path =~ s/\.[^.]+$/.style/; + if (-f $style_path) { + read_text_file $style_path, \%styleargs; + $args{scriptstyle} = $styleargs{content}; + } return Template($template)->render(\%args), html => \%args; } @@ -74,6 +83,42 @@ sub news_page { return Template($template)->render(\%args), html => \%args; } +# This view is used to wrap html. It takes a +# 'template' argument and a 'path' argument. +# Assuming the path ends in foo.html, any files +# like foo.page/bar.mdtext will be parsed and +# passed to the template in the "bar" (hash) +# variable. + +sub html_page { + my %args = @_; + my %styleargs = @_; + my $file = "content$args{path}"; + my $template = $args{template}; + $args{breadcrumbs} = breadcrumbs($args{path}); + + read_text_file $file, \%args; + + my $page_path = $file; + $page_path =~ s/\.[^.]+$/.page/; + if (-d $page_path) { + for my $f (grep -f, glob "$page_path/*.mdtext") { + $f =~ m!/([^/]+)\.mdtext$! or die "Bad filename: $f\n"; + $args{$1} = {}; + read_text_file $f, $args{$1}; + } + } + + my $style_path = $file; + $style_path =~ s/\.[^.]+$/.style/; + if (-f $style_path) { + read_text_file $style_path, \%styleargs; + $args{scriptstyle} = $styleargs{content}; + } + + return Template($template)->render(\%args), html => \%args; +} + sub sitemap { my %args = @_; my $template = "content$args{path}";