[Fwd: Re: Wrapping HTML in templates]
Christian Robottom Reis
kiko at async.com.br
Fri Sep 3 20:25:52 UTC 2004
So this one starts with another practical question. Here I have:
[% FILTER closed(isclosed) +%]<a title="[% INCLUDE buginfo bug=bug %]" href="show_bug.cgi?id=[% bugid %]"><b>[% terms.bug %] [%+ bugid %]</b></a>[% END %]<span class="summ_text">: [%+ bug.summary FILTER html %]</span><span class="summ_info">[[% INCLUDE buginfo %]]</span>
This one is tricky. First answer is:
[% FILTER closed(isclosed) %]
<a title="[% INCLUDE buginfo bug=bug %]"
href="show_bug.cgi?id=[% bugid %]">
<b>[% terms.bug %] [%+ bugid %]</b></a>
[% END %]
<span class="summ_text">: [%+ bug.summary FILTER html %]</span>
<span class="summ_info">[[% INCLUDE buginfo %]]</span>
This is obviously wrong: it adds a space before the <a> (because of the
newline after FILTER), and a space between <a> and <b>, because of the
newline there too. It also adds spaces around and between the spans. The
obvious alternative to the first problem:
[% FILTER closed(isclosed) -%]
<a title="[% INCLUDE buginfo bug=bug %]"
Doesn't work either (though I'm not sure why, I know it doesn't from
working on CSVs [1]). So we're stuck with:
[% FILTER closed(isclosed) %]<a title="[% INCLUDE buginfo bug=bug %]"
Which now causes a problem for all the rest. Some additional efforts:
[% FILTER closed(isclosed) %]<a title="[% INCLUDE buginfo bug=bug %]"
href="show_bug.cgi?id=[% bugid %]"><b>[% terms.bug %] [%+ bugid %]</b></a>
or:
[% FILTER closed(isclosed) %]<a title="[% INCLUDE buginfo bug=bug %]"
href="show_bug.cgi?id=[% bugid %]"><b>[% terms.bug %] [%+ bugid %]</b></a>
both leave me unsatisfied, but let's assume I have to choose between
them. I haven't even started discussing <span>, so let's start now:
[% FILTER closed(isclosed) %]<a title="[% INCLUDE buginfo bug=bug %]"
href="show_bug.cgi?id=[% bugid %]"><b>[% terms.bug %]
[%+ bugid %]</b></a><span
class="summ_text">:
[%+ bug.summary FILTER html %]</span><span
class="summ_info">[[% INCLUDE buginfo %]]</span>
But no, Jouni will never accept that <wink>. Let's try some more:
[% FILTER closed(isclosed) %]<a title="[% INCLUDE buginfo bug=bug %]"
href="show_bug.cgi?id=[% bugid %]"><b>[% terms.bug %]
[%+ bugid %]</b></a><span class="summ_text">: [%+ bug.summary FILTER html %]</span><span class="summ_info">[[% INCLUDE buginfo %]]</span>
But that violates the 80-char line rule as well. And at this point, I
don't know what to do, and I've wasted 1 hour of my life trying to
figure out decent ways of getting this to wrap correctly.
While I have always strived to get indentation and wrapping correct, I
feel there are a lot of better things that I could spend my time on than
this. I'm sure you all will agree, and this is why I call for the
following guideline:
If the wrapping and indentation of a block of a spacing-sensitive TT
text doesn't look really nice, you can *ask* or [nit] about it, but
given that in many situations it's close to impossible to get right,
don't block review on it.
[1] Anyone have a clue why that doesn't work? I think it has to do with
FILTER outputting its own HTML.
Note however that even if it did, I can sit down and contrive an example
of where the FILTER itself is *not* the culprit and that there simply is
no way to avoid the wrapping and spacing issue presented here.
Take care,
--
Christian Robottom Reis | http://async.com.br/~kiko/ | [+55 16] 3361 2331
More information about the developers
mailing list