Newlines embedded in the middle of an
HTML construct - such as a table - are counted for formatting. For example, For example, consider how the following table
should be laid out (view
https://www.twiki.org/cgi-bin/view/Codev/WhitespaceInHTMLCounts?raw=on to see source)
| This is a TD |
This is another TD |
| This is a TD |
This is another TD |
As
MichaelSamuels helpfully pointed out on
TWikiIRC, TWiki is inserting <p /> tags into the table. I believe this is not legal
XHTML.
--
CrawfordCurrie - 17 Mar 2004
Yes, this is fairly horrible, but at the same time I'm not sure how to solve it. TWiki arbitrarily mixes two languages,
HTML and
TWikiML, without a clear definition of whether any given syntactic element is in
TWikiML or
HTML (except that
TWikiML gets processed first). I tried to fix the TWiki paragraph formatting code a while back so that it would not emit unneeded
<p> tags, but it's a lot harder than it looks at first - for example, if a 'paragraph' preceded by a blank line starts with
HTML markup, should a
<p> tag be emitted (because it's a new para) or suppressed (because we are really in a 'full
HTML' part of the page). There's some code at
MozillaNotStylingXHTML but it's broken for important cases at present.
Maybe TWiki should do some basic
HTML tag parsing (just matching beginning and ending tags, not real parsing) to work out whether it's in an 'HTML area' or not? Or maybe there should be a special
TWikiML tag, e.g.
<usehtml> tag pair, that says 'here be
HTML, don't touch it'? You could then put it around tables that have embedded newlines.
--
RichardDonkin - 17 Mar 2004
Fixing this is not trivial as Richard pointed out, it also could reduce the performance.
Strictly speaking this is a bug. However, since we encourage users to use
TWikiML instead of
HTML, one could argue that people who use
HTML (e.g. to create
TWikiApplication) should be aware not to use empty lines between
HTML tags where it is not allowed to use paragraphs.
Is there any need for empty lines between
HTML tags?
TWiki does allow
HTML but with some limitations. For example, a tag cannot span more then one line. On the same line, the empty line limitation could be a documentation question, not a bug fix.
--
PeterThoeny - 18 Mar 2004
The only reason I noticed it is because the tableprepend template to the
CommentPlugin was leaving blank lines in the middle of tables. It's a difficult decision when faced with a choice between allowing
TWikiML between
HTML tags and disallowing it. But it's also a shame that TWiki can't claim XHTML1.0 compliance. On balance a documentation fix would be fine. Note that while XHTML1.0 compliance isn't claimed in the documentation (AFAICT), it is certainly implied in
TWikiSystemRequirements
--
CrawfordCurrie - 18 Mar 2004
This is now documented in
TextFormattingRules
--
PeterThoeny - 11 Jul 2004