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

Re: <protect> does not work



On Sat, 12 Feb 2000, Wolfgang Dautermann wrote:

> Hi,
> 
> I want to create two pages from one input file - one html-only page
> and one with php-scripts. A small example:
> 
> #use wml::std::lang
> <lang:new id=html>
> <lang:new id=php>
> <lang:star:slice: %BASE.*>
> <h1> Linux</h1>
> <lang:html></lang:html>
> <lang:php>
> <H3>Linux Headlines</H3>
> <P>
> <protect>
> <?php
>          readfile("http://lwn.net/headlines/html");
> ?>
> </protect>
> </lang:php>
> 
> Wml (1.7.4) should leave the php-code (everything between "<?php" and
> "?>") untouched - therefore the <protect>-container.

This patch should fix your problem. Apply it against wml.src or the wml
perl script.

Regards

--- wml_frontend/wml.src	2000/01/07 23:23:16	1.37
+++ wml_frontend/wml.src	2000/02/12 20:50:24	1.38
@@ -829,22 +829,29 @@
 
 sub pass9 {
     my ($opt, $from, $to, $tmp) = @_;
-    my ($rc, $shebang, @ARGV, @X);
+    my ($rc, $shebang, @X);
 
-    #   first check whether a shebang line is found
-    open(SLICE,"<$from");
-    $shebang = <SLICE>;
-    close(SLICE);
-    if ($shebang =~ m|%!slice\s+(.*)$|) {
-        #   this line has been produced by previous passes
+    #   first check whether a shebang line is found and no
+    #   output files were assigned on command line
+    if ($#opt_o == -1) {
+        open(SLICE,"<$from");
+        do { $shebang = <SLICE>; }
+            while ($shebang =~ m|^\s*$|);
+        @ARGVLINE = @ARGV;
         @ARGV = ();
-        @X = &split_argv($1);
-        push(@ARGV, @X);
-        &ProcessOptions();
-        #   Don't override command-line output file options
-        &ProcessOutfiles() if $#opt_o == -1;
-        $opt = "$verbose $out";
-        $out_istmp = 0;
+        while ($shebang =~ m|%!slice\s+(.*)$|) {
+            @X = &split_argv($1);
+            push(@ARGV, @X);
+            $shebang = <SLICE>;
+        }
+        close(SLICE);
+        if ($#ARGV > -1) {
+            &ProcessOptions();
+            &ProcessOutfiles();
+            $opt = "$verbose $out";
+            $out_istmp = 0;
+        }
+        @ARGV = @ARGVLINE;
     }
     #   slice contains "package" commands and
     #   other stuff, so we cannot source it.

-- 
Denis Barbier
WML Maintainer

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