[jmasonhacks commit] r15 - trunk/uffizi

4 views
Skip to first unread message

codesite...@google.com

unread,
Dec 28, 2007, 7:33:44 AM12/28/07
to jmasonh...@googlegroups.com
Author: jmason
Date: Fri Dec 28 04:33:09 2007
New Revision: 15

Modified:
trunk/uffizi/uffizi.txt

Log:
add patch from Cherry G Mathew (cherry at zyx.in) to add
__INCLUDEFILE__ directive

Modified: trunk/uffizi/uffizi.txt
==============================================================================
--- trunk/uffizi/uffizi.txt (original)
+++ trunk/uffizi/uffizi.txt Fri Dec 28 04:33:09 2007
@@ -65,11 +65,11 @@

=head1 VERSION

-0.5 Jan 4 2006 jm
+0.7 Dec 28 2007 jm

=cut

-my $GENERATOR = "uffizi/0.4 (http://jmason.org/software/uffizi/)";
+my $GENERATOR = "uffizi/0.7 (http://jmason.org/software/uffizi/)";

my $KNOWN_IMG_EXTNS = qr{
jpe?g | jpe | gif | png | bmp | icon? | miff |
@@ -1014,13 +1014,16 @@
}
}

-
sub fill_tmpl {
my ($tmpl, $opts) = @_;
my $out = $tmpl;

1 while $out =~ s!__TEMPLATE:([_a-zA-Z0-9]+)__! $template{$1} !xgs;

+ 1 while $out =~ s{
+ __INCLUDEFILE:[\"\']([-_a-zA-Z0-9\./\ ]+)[\"\']__
+ }{ tmpl_include_file ($1); }xges;
+
# conditionals
if ($out =~ /<__COND_IF_/) {
$out =~ s{<__COND_IF_\(([_a-zA-Z0-9]+)\)__>
@@ -1047,6 +1050,13 @@
return $out;
}

+sub tmpl_include_file {
+ my ($filename) = @_;
+ open (IN, "<$filename") || die "Template error: could not find file
included with __INCLUDEFILE:$filename";
+ my $contents = join ('', <IN>); close IN;
+ return $contents;
+}
+
sub tmpl_cond_if {
my ($cond, $textiftrue, $textiffalse) = @_;
if ($cond) {
@@ -1481,3 +1491,7 @@
}
</templatechunk>
</uffizitheme>
+
+Note: you can also include files like this:
+__INCLUDEFILE:"../name/of/file"__
+

codesite...@google.com

unread,
Dec 28, 2007, 7:33:44 AM12/28/07
to jmasonh...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages