SV: [ZPT] mangled source

Guido van Rossum guido@digicool.com
Mon, 25 Jun 2001 09:41:10 -0400


> > Ah, the wrapping feature.  We do this because the HTML/XML parsers
> > don't tell us where and what the whitespace in the source is.  To turn
> 
> Why is the result 
> 
>          <td 
>      tal:content="here/blah/blah">text</td>
> 
> instead of something like
> 
>          <td 
>           tal:content="here/blah/blah">text</td>
> 
> ?

Normally it tries to align like so:

      <td foo="bar"
          "bar="foo">

but when the start of the tag is indented very far, it reduces the
indent to 4 spaces instead:

                           <td foo="bar"
    "bar="foo">

Otherwise the wrapping feature would not be much use.

But I notice a bug.  Fred -- could this have been introduced by the
optimization stuff???  This is with the latest CVS.

When I remove the "wrap=0" option from interpretit() in TAL/driver.py,
the following input 

<aa href="asdasdasdasdasdasdasdasdasdasdasdasdasasdsadasdasdasdsadasdasd"
    tal:content="string:dasdasdasdasdasdasdasdasdasdasdasdasdds">
</aa>

causes this input:

<aa href="asdasdasdasdasdasdasdasdasdasdasdasdasasdsadasdasdasdsadasdasd"
      tal:content="string:dasdasdasdasdasdasdasdasdasdasdasdasdds">
</aa>

It looks like it emits two spaces too many!  If the tag is longer, it
gets worse:

<aaa href="asdasdasdasdasdasdasdasdasdasdasdasdasasdsadasdasdasdsadasdasd"
        tal:content="string:dasdasdasdasdasdasdasdasdasdasdasdasdds">
</aaa>

It seems the length of the tag is counted twice for the offset
calculations.

(Note that because the driver uses wrap=0 by default, the wrapping
feature is completely untested by the test suite!)

--Guido van Rossum (home page: http://www.python.org/~guido/)