MartinCleaver_: I have a table, inside of the cells of which are includes. Performing the include seems to instruct TWiki to stop the table [10:31am] MartinCleaver: I want the included data IN the table [10:32am] xored: To stop the table means, that the HTML code is broken or what does that mean ? [10:32am] MartinCleaver: it means TWiki emits a /table [10:32am] MartinCleaver: it fact, it emits a /tr /tbody /table [10:32am] MartinCleaver: does the include [10:33am] MartinCleaver: and then starts a table tbody tr td after the include [10:33am] det_re joined the chat room. [10:34am] xored: Cant help you with that sorry [10:34am] xored: not using TML tables at all [10:34am] MartinCleaver: It's as if the INCLUDE is processing [10:34am] • MartinCleaver reads VarINCLUDE [10:35am] MartinCleaver: thanks anyway xored [10:35am] MartinCleaver: INCLUDE raw didn't help [10:38am] • MartinCleaver curses [10:45am] You left the chat by being disconnected from the server. [10:46am] You rejoined the room. [10:48am] det_re_ left the chat room. (Read error: 110 (Connection timed out)) [10:55am] MartinCleaver: seems to be the <br/> in the include that breaks the table [10:55am] • MartinCleaver wonders why [11:10am] MartinCleaver: y, if the included topic has <br>line1</br><br>line2</br><br>line3</br> instead of line1<br/>line2<br/>line3</br> the table does not break [11:10am] MartinCleaver: its because it thinks br/ is unmatched [11:10am] MartinCleaver: which is not true.
<br> elements, whether unbalanced or
not.
Consider the following single line:
%INCLUDE{"%TOPIC%" section="includedtable"}%
This is an INCLUDE tag followed by a line feed. When the INCLUDE
tag is processed, it is replaced by whatever it points to, from the
opening to the closing percent character. *The line feed remains as
it is*.
So, if whatever you include in such a way ends with a line feed, you
end up with two consecutive line feeds. Two consecutive line feeds
will break the table. And a list. And will break paragraphs.
I'd always assume that TWiki topics end with a line feed, and if I
recall correctly TWiki enforces this if you edit a topic without a
line feed at its end. But the situation is even more tricky with
named sections, like the following:
%STARTSECTION{"brokensection"}%
| m11 | m12 |
| m21 | m22<br>broken |
| m31 | m32 |
%ENDSECTION{"brokensection"}%
This section ranges from the closing percent sign of the
STARTSECTION tag up to the opening percent sign of the ENDSECTION
tag. It starts with a line feed, and it ends with a line feed.
Better, and more consistent with included topics, is to always make
sure that a named block starts without a newline. The most readable
way, in my opinion, is to disable the line feed with a backslash \:
%STARTSECTION{"bettersection"}% \
| m11 | m12 |
| m21 | m22<br>better |
| m31 | m32 |
%ENDSECTION{"bettersection"}%
Now let's proceed to the INCLUDE tag itself. Since we know that the
block, or topic, to be included will end with a line feed, the easiest
thing is to disable the line feed by again appending a backslash to
the include line:
| *column 1* | *column 2* |
%INCLUDE{"%TOPIC%" section="bettersection"}% \
| just another line ||
%INCLUDE{"%TOPIC%" section="bettersection"}% \
| want a footer, too? ||
This renders as:
| column 1 | column 2 |
|---|---|
| m11 | m12 |
| m21 | m22 better |
| m31 | m32 |
| just another line | |
| m11 | m12 |
| m21 | m22 better |
| m31 | m32 |
| want a footer, too? | |
INCLUDE makes perfect sense if and only if it
keeps the line feeds. Stray spaces and line feeds have been nerdy
since the decades of TeX, through the Template Toolkit (which also
has a special syntax to gobble trailing line feeds), and TWiki is no
exception.
-- HaraldJoerg - 13 May 2008
As a sidenote, for proper XHTML and browser compatibility use %BR% or <br /> (including space).
-- PeterThoeny - 13 May 2008