Last modified: 2011-07-14 22:24:28 UTC
Nesting of <pre> and <nowiki> and use of these tags within lists does not work properly. Examples of the problems ------------------------ There are a number of problems with nested tags. For example, look at http://meta.wikimedia.org/wiki/Help:Editing_FAQ#Q:_Can_I_put_preformatted_text_inside_a_numbered_list.3F Even the 'What you type' example for <pre> on the following page doesn't work!! http://meta.wikimedia.org/wiki/Help:Advanced_editing This tries to use <nowiki> to display the <pre> and </pre> tags, but the <nowiki> is displayed when it is not wanted, and the </pre> is not displayed. I have tried to use the various workarounds that have been suggested, but it is really difficult to work out what is going to work and what not, and I can't achieve all I want whatever I try. I appreciate the problem of breaking existing wiki text, but most of the problems are things that have to be avoided, rather than actually used. I have seen a report that discusses some of these problems with numbered lists, but despite trying various different incantations, I cannot get the structuring to work properly. Blank lines inside <pre> either turn off the box formatting, or leave a blank line and then start the box again. <pre> in some situations works within a numbered list, but then you can't put another paragraph after that is indented to the samelevel as the numbered paargraph. I want to do all of the following - this should be included in the test cases. ------ Two important things are 1. Item one 2. Item two ------------ | this command | | another command ------------- Then type -------------- | some command | another command | | something else -------------- but also important is 3. Item three 4. Item four ---------- I have marked this as high priority because even the example on the wikimedia web-site does not work properly.
1) <pre> inside lists is bug 1581. 2) <pre> will stop at the first </pre> it finds. If there is an exactly matching nested <nowiki>, as <pre><nowiki>...</nowiki></pre>, the <nowiki></nowiki> will be ignored (it's unneeded anyway); if it appears to be <pre><nowiki>...</pre>, the <nowiki> will not be matched and so will be treated as literal. This is what happens when you try <pre><nowiki><pre></pre></nowiki></pre>; it ends at the first </pre>, before the </nowiki>. To get it to work correctly, you need to escape it as </ pre>. This behavior is intended; otherwise, <pre><pre></pre> would display incorrectly, for instance, waiting for an extra </pre> that will never come. It may be confusing, but I see no way to help that. You need to use entity escaping.
The same is with other <foo> </foo> syntax. a) I found dome templates where <noinclude> <noinclude> </noinclude> </noinclude> was added by *bots*. The result have been wrong interwiki links generated in such temülates. b) The same is with <nowiki> <nowiki> </nowiki> </nowiki> It makes documentation hardly.
(In reply to comment #1) > 1) <pre> inside lists is bug 1581. > > 2) <pre> will stop at the first </pre> it finds. ... This is correct. comment #1 describes todays behaviour. a *real* parser shouls handle also correctly nested <foo> <bar> </bar> </foo> syntax. also <pre> <pre> </pre> </pre> <nowiki> <nowiki> </nowiki> </nowiki> <noinclude> <noinclude> </noinclude> </noinclude> etc.
*** Bug 29879 has been marked as a duplicate of this bug. ***
It appears to me that the parser really needs a stack to parse nested tags correctly, so it can pop them off the stack the correct LIFO order.
Solving this bug: https://bugzilla.wikimedia.org/show_bug.cgi?id=29889 Will probably end up solving the current bug here, reported by Tim Lyons.