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

[wml] usable snapshot



Hi,

i committed tonight some changes in WML to implement cases (A) and (C)
discussed in previous mails.  Basically, mp4h has a -X flag to change its
behaviour, case (C) is the default case (A) is emulated with -X 3073.
case (B) with -X 3074.
When calling mp4h from wml, you can change expansion flags with the -W
wml flag, e.g.  -W2,'-X 32'

You may wonder what are these numbers for, here is a brief description:
      1 do not parse unknown tags
      2 unknown tags are assumed being simple
      4 trailing star in tag name do not make this tag simple
      8 leave the trailing star in tag name
     16 leave the trailing slash in tag attributes
     32 backslashes are expanded in compatibility mode
   1024 suppress warnings about bad nested tags
   2048 suppress warnings about missing trailing slash

Below are some points about quoting, which has not been discussed yet.
In HTML, quotes are used to group attribute values. Single or double
quotes are allowed, and it is possible to `escape' them with a
backslash.

So surprisingly, i decided that in mp4h, quotes are also used to group
attribute values.  But only double quotes are supported (i did not try
to implement single quotes), and they can be escaped too.

This sounds simple, now let us discuss about how it really works. One
problem is that attribute values may contain other tags, which in turn
may contain attributes, etc.

With Meta-HTML we wrote
  <group "<set-var src=\"foo.gif\">">
  <group "<img src=\"foo.gif\">">
  print  "<set-var src=\"foo.gif\">"
  print  "<img src=\"foo.gif\">"

With defined tags, quotes do not need to be escaped, because each tag
must be well-formed, so in
  <group "<set-var src="foo.gif">">
         1             2       3  4
quote 2 cannot end string beginning at quote 1, because the <set-var>
tag is not finished. So quote 2 begins a new string, and next steps
are obvious.
For this reason, i prefer this syntax:
  <group "<set-var src="foo.gif">">
  print  "<set-var src="foo.gif">"

Following rules describe how quoting and escaping 
  * quotes are special only in attributes
  * quotes within quotes are escaped by a backslash
  * backslashes are special only in strings within attributes

The last rule is to ensure that
  print  "<"."img src=\"foo.gif\">"
will be right.
A final note about escaping: a compatibility mode is written.  This
compatibility refers to Meta-HTML, in which we must write
   <subst-in-string "abc" "\\(.\\)" "\\1 ">
Backslashed are printed twice, because one is gobbled at parsing time.
When not in compatibility mode, only backslashes before 'n', 'r', 't',
'"' and '\' are special, so one may write
   <subst-in-string "abc" "\(.\)" "\1 ">
which is much more natural.

Well, some points must be rephrased, but i believe that this whole
syntax is good.  If you want to try it, check out the latest wml
snapshots (at least wml-SNAP-200006090600)

The final question is which expansion scheme do we want now as default?

-- 
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