aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-01 01:35:29 +0000
committerfiddlosopher <fiddlosopher@788f1e2b-df1e-0410-8736-df70ead52e1b>2007-01-01 01:35:29 +0000
commit0c6c5d528be44a8a5f599aa114e0890bc7e5e684 (patch)
tree1029c64b29290cf00bc0d69bd9271944f2f6aaba /src
parente9abe72a274d2dc1149fe2976d2eafaee017d371 (diff)
downloadpandoc-0c6c5d528be44a8a5f599aa114e0890bc7e5e684.tar.gz
Refactored fillTemplates.pl.
git-svn-id: https://pandoc.googlecode.com/svn/trunk@366 788f1e2b-df1e-0410-8736-df70ead52e1b
Diffstat (limited to 'src')
-rw-r--r--src/templates/fillTemplates.pl39
1 files changed, 14 insertions, 25 deletions
diff --git a/src/templates/fillTemplates.pl b/src/templates/fillTemplates.pl
index 037aea659..85e6eaa18 100644
--- a/src/templates/fillTemplates.pl
+++ b/src/templates/fillTemplates.pl
@@ -37,22 +37,15 @@ my %processor = (
proc => sub {
my ($template) = @_;
- my $slides = escape_for_haskell(slurp "ui/default/slides.js");
- my $s5core = escape_for_haskell(slurp "ui/default/s5-core.css");
- my $framing = escape_for_haskell(slurp "ui/default/framing.css");
- my $pretty = escape_for_haskell(slurp "ui/default/pretty.css");
- my $opera = escape_for_haskell(slurp "ui/default/opera.css");
- my $outline = escape_for_haskell(slurp "ui/default/outline.css");
- my $print = escape_for_haskell(slurp "ui/default/print.css");
-
- $template =~ s/\@slides\.js@/$slides/;
- $template =~ s/\@s5-core\.css@/$s5core/;
- $template =~ s/\@framing\.css@/$framing/;
- $template =~ s/\@pretty\.css@/$pretty/;
- $template =~ s/\@opera\.css@/$opera/;
- $template =~ s/\@outline\.css@/$outline/;
- $template =~ s/\@print\.css@/$print/;
-
+ my (@files) = qw(slides.js s5-core.css framing.css pretty.css
+ opera.css outline.css print.css);
+
+ foreach my $file (@files) {
+ my $replacement = escape_for_haskell(slurp "ui/default/$file");
+ my $escapedfile = $file;
+ $escapedfile =~ s/\./\\./g;
+ $template =~ s/\@$escapedfile\@/$replacement/;
+ }
return $template;
},
},
@@ -79,15 +72,11 @@ my %processor = (
proc => sub {
my ($template) = @_;
- my $html = escape_for_haskell(slurp "headers/HtmlHeader");
- my $latex = escape_for_haskell(slurp "headers/LaTeXHeader");
- my $rtf = escape_for_haskell(slurp "headers/RTFHeader");
- my $s5 = escape_for_haskell(slurp "headers/S5Header");
-
- $template =~ s/\@HtmlHeader@/$html/;
- $template =~ s/\@LaTeXHeader@/$latex/;
- $template =~ s/\@RTFHeader@/$rtf/;
- $template =~ s/\@S5Header@/$s5/;
+ my (@headers) = split(/\s/,`ls headers`);
+ foreach my $header (@headers) {
+ my ($replacement) = escape_for_haskell(slurp "headers/$header");
+ $template =~ s/\@$header\@/$replacement/;
+ }
return $template;
},