MT comment bug; Convert Line Breaks + dl
By Oli
At 3:28 PM · Sunday, 15 February · 2004
To Coding · HTML · Weblogging
I’ve come across an interesting bug in the otherwise great interaction between “Convert Line Breaks” (a comment configuration text formatting option) and block-level HTML. Convert Line Breaks replaces one return with a <br />, and two returns with enclosing <p> tags. It is smart enough to recognize <ul> and <ol> and does not tag enclose if surrounded by white space. It also recognizes <li> if separated by a single return. This allows me to use HTML in comments while leaving the whitespace tags to MT, and for the comments to be friendly to anyone not using HTML.
However the system doesn’t recognize <dl>, <dt> or <dd>. Even more interesting, for the first <dd> followed by 2 returns the closing </dl> is ‘stolen’ and added after the <dd>. This leaves any following <dt> and <dd> tags without an opening or closing <dl>.
I’ll post the following code in a comment below:
<dl><dt>Definition list title 1</dt><dd>Definition 1 (followed by two returns)</dd>
<dt>Title 2</dt><dd>Definition 2</dd></dl>
However it will end up as this:
<p><dl><dt>Definition list title 1</dt><dd>Definition 1 (now followed by the </dl> that ended this list)</dd></dl></p>
<p><dt>Title 2</dt><dd>Definition 2</dd></p>
Strange huh? I hope that the behavior for <ul> and <ol> will be extended to all non-Sanitized block-level HTML in comments, especially the much-used (by me at least ;-) <dl> tags.
Note: my settings are “Convert Line Breaks” and “Allow HTML In Comments”, and all of these tags are in my allowed list.
Discussion...
- 1. Comment by oli · 15 Feb, 2004 · 3:34 PM
Here is the same code (copied and pasted) from the article above:
- Definition list title 1
- Definition 1 (followed by two returns)
- Title 2
- Definition 2
You can view source to see how it’s been converted as described above.
- 2. Comment by oli · 15 Feb, 2004 · 7:25 PM
By the way, it would be nice if the mechanism that recognises the
uletc tags did so when there is only one return. Presently two returns leads to recognition, but one inserts a<br />character as usual.