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

Re: BUG REPORT: Website META Language 2.0.1 (23-May-2000)



On Tue, 23 May 2000, Howard Alexander LaHurreau wrote:

> PROBLEM DESCRIPTION:
> I'm having problems with the migration from 2.0.0 to 2.0.1.
> It appears that when mp4h reaches an unknown tag, it treats
> it as if it had been defined with whitespace=delete.

No, it parses attributes and writes them in a space separated list.

> The problem I'm having with this is that this code:
> ---------------8< cut here 8<---------------
>         print <<"END IMGLINK";
> <a href="$rss->{'image'}->{'link'}"><img src="$rss->{'image'}->{'url'}"
>  alt="$rss->{'image'}->{'title'}" border="0" align="right"
> END IMGLINK
>         print " width=\"$rss->{'image'}->{'width'}\""
>                 if $rss->{'image'}->{'width'};
>         print " height=\"$rss->{'image'}->{'height'}\""
>                 if $rss->{'image'}->{'height'};
>         print " /></a>\n";
> ---------------8< cut here 8<---------------

Let me try to explain what happens:
  Input     Interpretation
  print           string
   <<             these < delimiters can not begin a tag, because they
                  are followed by invalid characters (resp. < and ")
  "END IMGLINK";  string
  <a              beginning of an undefined tag.  We are looking for
                  attributes and a right angle bracket.
    href="$rss->{'image'}->{'link'}"  first attribute
  >               end of unknown tag
  <img            beginning of an undefined tag.  Below is the list of
                  attributes:
1    src="$rss->{'image'}->{'url'}"
2    alt="$rss->{'image'}->{'title'}"
3    border="0"
4    align="right"
5    END IMGLINK
6    print
7    " width=\"$rss->{'image'}->{'width'}\""
8    if
9    $rss-
  >               end of unknown tag (img)
  
  {'image'}->{'width'};   string, etc.

> gets turned into this code:
> ---------------8< cut here 8<---------------
>         print <<"END IMGLINK";
> <a href="$rss->{'image'}->{'link'}"><img src="$rss->{'image'}->{'url'}" alt="$rss->{'image'}->{'title'}" border="0" align="right" END IMGLINK print " width="$rss->{'image'}->{'width'}"" if $rss->{'image'}->{'width'};
>         print " height=\"$rss->{'image'}->{'height'}\""
>                 if $rss->{'image'}->{'height'};
>         print " /></a>\n";
> ---------------8< cut here 8<---------------

Indeed concatenate attributes of the img tag and you obtain the code
above.  The solution is to prevent parsing <img> tag, e.g. with

        print <<"END IMGLINK";
<a href="$rss->{'image'}->{'link'}"><<suck>img src="$rss->{'image'}->{'url'}"
 alt="$rss->{'image'}->{'title'}" border="0" align="right"
END IMGLINK

The <suck> tag prevents scanning by mp4h, and is automatically removed
in pass 8.
Another solution is to enclose your ePerl code with
<protect pass=2>...</protect> whenever possible.

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