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

Re: Substitution of asteriks



On 22 Mar 1999, Florian Hars wrote:

> Tobias Oetiker <oetiker@ee.ethz.ch> writes:
> > *> Is-it possible to combine two substitution of asteriks ?
> > sure, but the syntax must be
> > <navbar:button img = <lang:star: Icons-*>-*.gif>
> 
> This way you will get something like 
> <img src="[LANG_EN: Icons-en-n.gif][LANG_DE: Icons-de-n.gif]">
> and since the slice-pass comes after the html fixup pass in wml 1.6.8
> (IIRC Denis made some remarks about moving the fixup to the end of the
> pipline, where it belongs, what happend to this in SNAP?) this will
> not give you height and width attributes for your images.

Changing slice order implies a lot of changes: directory names, file
names, Makefiles, and of course wml itself.
I am working on it.

> The other way at least for your problem is my solution which I
> mentioned last week, which uses the hashmark (#) for the lang
> substitution:
> <navbar:button img=Icons-#-*.gif>
> and produces:
> [LANG_EN: <img src=Icons-en-n.gif>][LANG_DE: ...]
> which will be properly handeled by the fixup pass (and it saves you
> some keystrokes, too :-)).

The latter argument is not very important, the navbars are defined once
so saving 20 keystrokes does not really matter. The advantage of your
solution is to be htmlfix friendly. Its drawback is to be confusing for
beginners, i presume the ``img=<lang:star: Icons-*>-*.gif>'' is more
intuitive (and will be even more when documented :o) or even
``img=Icons-<lang:star: *>-*.gif>''. This is my preferred one.

Unfortunately, it doe not work, as you know.
One workaround is to write
    img=Icons-<protect pass=3><lang:star: *></protect>-*.gif>
and to apply the attached patch.
IMHO, it performs exactly what we want.
Any opinion? What does ``IIRC'' mean?

Florian, i will put your mynavbar.wml into the wml_contrib, and rename it.
Is navbar-hars.wml a good choice? Maybe you want to do some changes,
e.g. inserting a link to http://www.hars.de/www/mynavbar.wml. In this
case, send a mail off the list with your file attached.

Thanks.

    Denis

--
Dr D. Barbier
http://imacs.polytechnique.fr
--- wml	1999/03/18 15:00:32	1.9
+++ wml	1999/03/22 11:54:39
@@ -632,7 +632,7 @@
 
 sub unprotect {
     my ($file, $pass) = @_;
-    my ($fp, $data, $prefix, $key, $s);
+    my ($fp, $data, $prefix, $key, $s, @keys);
 
     $fp = new IO::File;
     $fp->open("<$file") || die "cannot load $file for unprotection";
@@ -641,6 +641,7 @@
         $data .= $_;
     }
     $fp->close;
+    @keys = ();
     $fp->open(">$file") || die "cannot load $file for unprotection";
     while ($data =~ m|^(.*?)-=P\[(\d+)\]=-(.*)$|is) {
         ($prefix, $key, $data) = ($1, $2, $3);
@@ -648,7 +649,7 @@
         if ($pass >= $s->{PE}) {
             $fp->print($prefix);
             $fp->print($s->{BODY});
-            $PROTECT_STORAGE{$key} = undef if $pass < 9;
+            push(@keys, $key);
         }
         else {
             $fp->print($prefix."-=P[$key]=-");
@@ -656,6 +657,9 @@
     }
     $fp->print($data);
     $fp->close;
+    foreach $key (@keys) {
+        $PROTECT_STORAGE{$key} = undef if $pass < 9;
+    }
 }
 
 sub pass1 {