Last modified: 2012-04-12 13:54:21 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T31879, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29879 - </noinclude> gets parsed within <pre></pre> in templates
</noinclude> gets parsed within <pre></pre> in templates
Status: RESOLVED DUPLICATE of bug 9428
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
1.16.x
All All
: Unprioritized normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-13 23:26 UTC by badon
Modified: 2012-04-12 13:54 UTC (History)
1 user (show)

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


Attachments

Description badon 2011-07-13 23:26:57 UTC
</noinclude> gets parsed within <pre></pre> in templates, causing explanatory text to be transcluded into pages. In the following example, everything after </pre> and </noinclude> incorrectly gets transcluded wherever the template is used. The only workaround is to use <includeonly></includeonly> instead of <onlyinclude></onlyinclude>, which should not be necessary, and can cause problems if that is not how the template was designed. 

This problem arises from the best-practice of encapsulating templatized category tags within no-include tags so that category transclusion will happen only once, not every time some other page uses the page that has a category template. 

Here's the example:

<noinclude>
This is a category template for quickly adding pages to some categories. It is supposed to put the following into a page:

<pre>
<noinclude>
<!-- If this page is embedded within another page, noinclude will prevent that page from unintentionally becoming part of these categories -->
[[Category:Stuff]]
[[Category:Some other stuff]]
</noinclude>
</pre>
</noinclude>

Here's a sentence that's not supposed to be transcluded, but will be due to this bug.

<includeonly>
<noinclude>
<!-- If this page is embedded within another page, noinclude will prevent that page from unintentionally becoming part of these categories -->
[[Category:Stuff]]
[[Category:Some other stuff]]
</noinclude>
</includeonly>
Comment 1 badon 2011-07-13 23:28:05 UTC
Forgot to mention that the solution to this bug is to have the parser treat <pre> like <nowiki>, and ignore all tags found within, including the </noinclude> tags that the parser is tripping over in this example.
Comment 2 badon 2011-07-13 23:56:09 UTC
It looks like there may be other problems with the way pre is parsed:

http://meta.wikimedia.org/wiki/Help_talk:Wikitext_examples#Pre-nowiki_inside_list_example_doesn.27t_seem_to_work
Comment 3 P.Copp 2011-07-14 21:17:45 UTC
The parser doesn't handle nested tags as you would expect. When it finds an <noinclude> start tag, it just searches for the next matching </noinclude> end tag, without considering nested start tags. See bug 9428 for more examples with other tags.

*** This bug has been marked as a duplicate of bug 9428 ***

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


Navigation
Links