Last modified: 2010-05-15 15:48:27 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 T9374, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 7374 - HTML-Tags are automatically closed when including template.
HTML-Tags are automatically closed when including template.
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
Depends on:
  Show dependency treegraph
Reported: 2006-09-19 22:17 UTC by René Treuber
Modified: 2010-05-15 15:48 UTC (History)
2 users (show)

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


Description René Treuber 2006-09-19 22:17:23 UTC
If you include a template using {{templatename}}, open HTML-Tags are closed
I have 2 templates, the first opens the tag, the second should close them, but
the tags are already closed directly after first included.

Step1: create 2 templates
   template1: "setlist_start", content is: "<div style='...'><div style='...'>"
   template2: "setlist_end", content is: "</div></div>" 
Step2: create a (new) wiki-page with content:
This should be inside the divs!

the tags of the start-template are closed directly, so the div are not around
the content.
<div style='...'><div style='...'></div>
This should be inside the divs!<p>&lt;/div&gt;

the tags are not automatically closed!
<div style='...'><div style='...'>
This should be inside the divs!

Maybe this can be solved by including another tag to the template like the
"<noinclude>" tag, e.g. "<leavetagsopen>" or sth.
Comment 1 Justin Rhinesmith 2006-12-13 17:14:32 UTC
I still see this in 1.8.2 and fixing it would be a big help to those wishing to create Wikipedia style portals 
on their site without having to install and run HtmlTidy.
Comment 2 Justin Rhinesmith 2006-12-13 17:16:06 UTC
This site:

also has a good write up about the bug.
Comment 3 Aryeh Gregor (not reading bugmail, please e-mail directly) 2006-12-13 17:26:10 UTC
I find Brion's comment there interesting:

> IIRC, there's a bug in the parser cleanup when HTML Tidy is enabled which causes
> it to _not_ close the open tags for each template.

Why would this be intended behavior?  Is there a problem with not closing tags
automatically before transclusion, only after?
Comment 4 Justin Rhinesmith 2007-03-21 18:30:09 UTC
I don't think that it is intended behavior.  The nature of the bug seems not to affect Wikipedia (or any other site using MediaWiki) 
only as a result of having HTML Tidy enabled.  However, if being able to open a div tag with one template and close it with another 
(as is used on all Wikipedia portal pages) is acceptable usage, then it should work regardless of whether HTML Tidy is turned on or 
Comment 5 Tim Starling 2007-06-15 23:34:00 UTC
The problem is that Sanitizer::removeHTMLtags() fulfills two roles: to clean up the whole document when called from Parser::internalParse(), and to clean up template output when called from Parser::braceSubstitution(). It is not necessary to close HTML tags opened in templates -- any attempt to do so would break thousands of templates on Wikipedia and elsewhere. The fact that this does not work on default installations is counterintuitive and is the source of many complaints. Template syntax is not versatile or complete enough to allow generation of enclosing boxes such as tables, table rows and divs. 

In my opinion, template expansion should properly be a preprocessing step, unaware of non-template syntax details (except for HTML-style extension tags). removeHTMLtags() should be done once only: after replaceVariables() completes.
Comment 6 Brad Will ( 2007-06-19 13:45:38 UTC
Just an fyi to anyone else who runs into this situation.  In an extension that I wrote, I was calling a pre-defined template on my site that included wikitext table chars ( {|, |-, |}, etc), and then I was trying to run it through $wgOut->addWikiText.  It wouldn't convert the characters to their HTML equivalents.    So, instead of converting |- to a "tr" tag, it would just insert |- into the page.  Tim looked into it, and said that it was being caused by this bug.
Comment 7 P.Copp 2009-11-26 03:42:36 UTC
(In reply to comment #5)
> In my opinion, template expansion should properly be a preprocessing step,
> unaware of non-template syntax details (except for HTML-style extension tags).
> removeHTMLtags() should be done once only: after replaceVariables() completes.
This has been implemented with the new preprocessor.

Marking as FIXED

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