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

Another bug? [wml 2.0.6]



I just don't understand this one.  I've abridged the original files
extensively, but this excerpt still shows the problem.  This is in WML 2.0.6,
of course.

===============================================================================
<html>
<head>
<title>test</title>
</head>

<body bgcolor = "#ffffff">

#use wml::std::tags
#use wml::des::typography

<perl>
{
    #  &smallcap() takes an attribute string and a body, and generates
    #  smallcaps using <font> tags.  The only attribute recognized is lcsize,
    #  which specifies the size of the "lowercaps."

    use locale;
    sub smallcap {
	my( $attr, $body ) = @_;
	my( %attr ) = ($attr =~ /(\S+)="(.*?)"/g);
	my( $lcsize ) = $attr{"lcsize"} ? $attr{"lcsize"} : "-1";
	my( $result ) = "";
	while( $body ) {
	    if( $body =~ /^(<[^>]+>|[^a-z]+|&\w+;)(.*)$/ ) {
		# got a tag or non-lowercase characters or entities
		$result .= $1;
		$body = $2;
	    } elsif( $body =~ /^([a-z]+)(.*)$/ ) {
		# got lowercase characters
		$result .= qq{<font size="$lcsize">} . uc( $1 ) . "</font>";
		$body = $2;
	    }
	}
	return( $result );
    }
}
</perl>

<define-tag sc endtag="required">\
<:= &smallcap( qq{<attributes-quote %attributes>}, qq{%body} ) :>\
</define-tag>

<define-tag titleblock endtag="required">
<hr>
<center>
<table width="80%">
<tr>
	<td align="center"><b>\
		<font size="+3"><sc lcsize="+2">%body</sc></font></b></td>
</tr>
</table>
</center>
<hr>
</define-tag>

<define-tag xtitleblock endtag="required">
<hr>
<center>
<table width="80%">
<tr>
	<td align="center">%body</td>
</tr>
</table>
</center>
<hr>
</define-tag>

<titleblock>This is a Test</titleblock>

</body>
</html>
===============================================================================

This works beautifully, producing

===============================================================================
<html>
<head>
<title>test</title>
</head>
<body bgcolor="#ffffff">
<hr>
<div align="center">
<table width="80%" summary="">
<tr>
	<td align="center"><b><font size="+3">T<font size="+2">HIS</font> <font size="+2">IS</font> <font size="+2">A</font> T<font size="+2">EST</font></font></b></td>
</tr>
</table>
</div>
<hr>
</body>
</html>
===============================================================================

(I don't know what that summary="" bit is in the <table> tag, but. . . .)  But
if I replace the <titleblock>...</titleblock> bit with

===============================================================================
<xtitleblock><font size="+3"><b><sc lcsize="+2">This is a
Test</sc></b></font></xtitleblock>
===============================================================================

wml appears to go into an infinite loop.  When I eventually break, I get

	ePerl: **INTERRUPT**
	** WML:Break: Error in Pass 3 (rc=1).

So what's going on here?  Did I miss something?

						---Ken McGlothlen
						   mcglk@artlogix.com
______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com