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

Re: Bug report: Problems with variables



On Thu, 8 Jul 1999, Uwe Mindrup wrote:

> Hi Denis,

Hi Uwe,

> template.wml:
> ---------------------------------
> <TITLE>$(Title)$(SubTitle:+: )$(SubTitle)</TITLE>
> ---------------------------------
> 
> The calls are:
> #use 'template.wml' Title="foo" SubTitle="Homepage"
> resp.
> #use 'template.wml' Title="foo"
> 
> Now it works, as i described in my further message: the first call
> produces correctly: "foo: Homepage" but the second call generates the
> wrong  "foo$(SubTitle)".

You're right. A shorter example is
   $(Title)$(Title)

To fix this bug, either insert any character between the two
``$(Title)'' or apply the attached patch.
prompt$ patch -p0 your_prefix/lib/exec/wml_p1_ipp <ipp.patch 

I fix the wml::std::info documentation too.
Thanx for the reports.

Denis
--- wml_backend/p1_ipp/ipp.src	1999/05/27 11:29:55	1.8
+++ wml_backend/p1_ipp/ipp.src	1999/07/08 21:53:03
@@ -265,18 +265,21 @@
         #   Variable Interpolation
         #
 
-        #   Indicate Error if Unset
-        $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):\?\[(.+?)\]\)/$arg{$2} ne '' ? $1.$arg{$2} : &error($3)/ge;
-        #   Use Default Values
-        $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):-([^\)]+)\)/$arg{$2} ne '' ? $1.$arg{$2} : $1.$3/ge;
-        #   Assign And Use Default Values
-        $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):=([^\)]+)\)/$arg{$2} ne '' ? $1.$arg{$2} : $1.($arg{$2}=$3)/ge;
-        #   Use Alternative Value
-        $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):\+([^\)]+)\)/$arg{$2} ne '' ? $1.$3 : $1/ge;
-        #   Use Negative Alternative Value
-        $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):\*([^\)]+)\)/$arg{$2} eq '' ? $1.$3 : $1/ge;
-        #   Normal Value
-        $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+)\)/$1.$arg{$2}/ge;
+        {
+            #   Indicate Error if Unset
+            redo if $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):\?\[(.+?)\]\)/$arg{$2} ne '' ? $1.$arg{$2} : &error($3)/ge;
+            #   Use Default Values
+            redo if $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):-([^\)]+)\)/$arg{$2} ne '' ? $1.$arg{$2} : $1.$3/ge;
+            #   Assign And Use Default Values
+            redo if $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):=([^\)]+)\)/$arg{$2} ne '' ? $1.$arg{$2} : $1.($arg{$2}=$3)/ge;
+            #   Use Alternative Value
+            redo if $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):\+([^\)]+)\)/$arg{$2} ne '' ? $1.$3 : $1/ge;
+            #   Use Negative Alternative Value
+            redo if $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+):\*([^\)]+)\)/$arg{$2} eq '' ? $1.$3 : $1/ge;
+            #   Normal Value
+            redo if $l =~ s/((?!\\).|^)\$\(([a-zA-Z0-9_]+)\)/$1.$arg{$2}/ge;
+        }
+
         #   Implicit Variables
         $l =~ s|__LINE__|$line|g;
         $l =~ s|__FILE__|$file|g;