Last modified: 2011-07-14 22:24:28 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 9428 - <pre> doesn't nest
<pre> doesn't nest
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
All All
: Lowest normal (vote)
: ---
Assigned To: Nobody - You can work on this!
: parser
: 29879 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2007-03-27 22:03 UTC by Tim Lyons
Modified: 2011-07-14 22:24 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Tim Lyons 2007-03-27 22:03:33 UTC
Nesting of <pre> and <nowiki> and use of these tags within lists does not work

Examples of the problems

There are a number of problems with nested tags. For example, look at

Even the 'What you type' example for <pre> on the following page doesn't work!!
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.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-03-27 22:36:50 UTC
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 &lt;/
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.
Comment 2 lɛʁi לערי ריינהארט 2009-12-15 18:28:16 UTC
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.
Comment 3 lɛʁi לערי ריינהארט 2009-12-16 21:21:27 UTC
(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>
Comment 4 P.Copp 2011-07-14 21:17:45 UTC
*** Bug 29879 has been marked as a duplicate of this bug. ***
Comment 5 badon 2011-07-14 22:22:50 UTC
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.
Comment 6 badon 2011-07-14 22:24:28 UTC
Solving this bug:

Will probably end up solving the current bug here, reported by Tim Lyons.

Note You need to log in before you can comment on or make changes to this bug.