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

Re: [wml] Problems with define-tag

On Tue, Jul 18, 2000 at 12:07:49AM +0200, Fritz Zaucker wrote:

> Denis,
> many thanks, I seem to start understanding the problem.
> On Mon, 17 Jul 2000, Denis Barbier wrote:
> > > Hmm, this didn't really help. And I think that the group-tags are
> > > needed, there are several lines belonging to the <ifeq clauses.
> > But there is only one token in each clause: <navbar:define>...</navbar:define>
> Ah, that's one token? So much for my understanding ...
> > Fortunately, your MAGICK macro is divided into 2 parts: initialization
> > of Perl variables, and processing.  The latter may be protected with
> > <protect pass=2>...</protect>.  In the former, replace quotes by qq
> > Perl operator:
> OK, this seems to have done the trick, at least the stuff
> compiles. Will have to look at it at work tomorrow, don't want to mess
> up the real site, but in lynx it looks ok ;-)

In conclusion, it is important to understand these points:
 * Quotes are used to group words in tag attributes.
 * It is impossible to determine whether double quotes are used to group
   words or must be printed on output.  For this reason, they are always
   removed from output when in attributes (this is a convention).  So
       <define-tag foo endtag=required>%body</define-tag>
       <foo> href="toto.html"</foo>
       <group <foo> href="toto.html"</foo>>
   expands with wml-2.0.2 to
   because last line is replaced by
       <group href="toto.html">
   which in turn becomes

   On the other hand, with the previous patch against builtin.c,
   attributes of <group> are expanded after being replaced
   (documentation claims that its attributes are read verbatim), so
       <group <foo> href="toto.html"</foo>>
       <foo> href="toto.html"</foo>
   and then
   There is a workaround with <group>, but it won't work with other

 * When quotes are needed on output (e.g. in Perl statements) they
   must be preserved in case they appear as attributes of a tag.
   There are several ways to do so:
    a) replace quotes by the qq Perl operator
    b) escaped quotes in strings are always written on output, e.g.
         <group "<: print \"Hello, world!\n\"; :>">
    c) protect quotes with <protect pass=2>...</protect>
    d) the <dq> tag should also do this job, but it is buggy in

Hope it is less confusing now.

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