You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by wa...@apache.org on 2011/08/09 02:21:05 UTC
svn commit: r1155167 - in /incubator/ooo/site/trunk/lib: path.pm view.pm
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}";