[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

feature patch



Hi,

In our wml setup I use custom preprocessor and postprocessor
scripts, defined via -P and -E in .wmlrc

Because I like to keep my preprocessor scripts within the web tree,
I thought it would be usefull if $(ROOT) and other '-D(efined)'
variables would work there too ...

I have added this functionality ...

my .wmlrc file now reads like this:

-----.wmlrc-------
-DROOT~.
-E $(ROOT)/.wml/htmlfix.sh
-P $(ROOT)/.wml/headfix.pl
------------------

and here is the patch (for 2.0.4) ...

--- wml.orig    Tue Feb 27 13:20:30 2001
+++ wml Tue Feb 27 13:33:37 2001
@@ -84,6 +84,17 @@
     return $str;
 }

+# replace $(xxx) with -Dxxx
+sub var_repl {
+    my $string = shift;
+    my $vars = shift;
+    foreach my $v (@$vars){
+        my ($key,$value) = split /=/, $v, 2;
+        $string =~ s/\$\($key\)/$value/g;
+    }
+    return $string;
+}
+
 sub usage {
     my ($progname) = @_;

@@ -1047,6 +1058,7 @@
 }

 #   determine prologs
+map {$_=var_repl($_, \@opt_D)} @opt_P; # replace $(xxx) with -Dxxx
 $prolog = '';
 foreach $p (@opt_P) {
     $prolog .= " -P '$p'";
@@ -1318,9 +1330,9 @@
          }
     }
     #   run epilog filters
+    map {$_=var_repl($_, \@opt_D)} @opt_E; # replace $(xxx) with -Dxxx
     foreach $o (@outfiles) {
         foreach $e (@opt_E) {
-
             if ($e =~ m|^htmlinfo(.*)|) {
                 $e = "/usr/pack/wml-2.0.4-za/lib/exec/wml_aux_htmlinfo$1";
             }



-- 
 ______    __   _
/_  __/_  / /  (_) Oetiker, Timelord & SysMgr @ EE-Dept ETH-Zurich
 / // _ \/ _ \/ / TEL: +41(0)1-6325286  FAX:...1517  ICQ: 10419518
/_/ \.__/_.__/_/ oetiker@ee.ethz.ch http://ee-staff.ethz.ch/~oetiker

______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com