Also, only *some* of the whitespace is significant. The whitespace inside <> is not. That leaves open the possibility of something like this:<br><br><foo bar="1"><<br> baz bam="2' /><<br>
/foo><br><br>Which at least has the virtue of wrapping ln less than 80 columns. I frequently format things this way, but I'm sure not everyone will agree that that is more readable.<br><br>C<br><br><div><span class="gmail_quote">
On 9/27/06, <b class="gmail_sendername">Samuel Reynolds</b> <<a href="mailto:sam@spinwardstars.com">sam@spinwardstars.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
At 04:56 PM 9/26/2006, you wrote:<br>>Phil Mayers ha scritto:<br>> > Manlio Perillo wrote:<br>> >><br>> >> this template:<br>> >><br>> >> <label>label:<br>> >> <select name="a_name" n:render="sequence"
<br>> >> n:data="a_list"><br>> >> <option n:pattern="item"><br>> >> <n:invisible n:render="string" n:data="0" />
<br>> >> <n:attr name="label" n:render="string" n:data="1" /><br>> >> </option><br>> >> </select><br>> >> </label>
<br>> ><br>> >> gives a:<br>> >><br>> >> <label>label:<br>> >> <select name="a_name"><option label="a_label"><br>> >><br>
> >> 1<br>> >><br>> >> </option><option label="another_label"><br>> ><br>> > Erm - yes. Because your template has whitespace in it. Remove it and it
<br>> > should work - that is:<br>> ><br>> > <label>label:<select name="a_name" n:render="sequence"<br>> > n:data="a_list"><option n:pattern="item">...
<br>> ><br>> ><br>><br>><br>>Ok, but I would like to have a readable template...<br>>This is the reason why I'm asking if it is possible to remove extra<br><br>Maybe do a simple regex cleanup before you use the template.
<br>Something like the following, which removes whitespace between<br> > and <, if the whitespace begins with a newline:<br><br> import re<br> ...<br> RE_removeFreeWhitespace = re.compile( r'>[\n\r]+\s*<' )
<br> def removeFreeWhitespace( S ):<br> return RE_removeFreeWhitespace.sub( r'><', S )<br> ...<br> templateString = removeFreeWhitespace( templateString )<br><br>- Sam<br><br><br><br>_______________________________________________
<br>Twisted-web mailing list<br><a href="mailto:Twisted-web@twistedmatrix.com">Twisted-web@twistedmatrix.com</a><br><a href="http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web">http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
</a><br></blockquote></div><br>