Last modified: 2010-05-15 15:48:27 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 7374 - HTML-Tags are automatically closed when including template.
HTML-Tags are automatically closed when including template.
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Templates (Other open bugs)
1.9.x
All All
: Normal normal with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
http://www.simo-wiki.de
:
Depends on:
Blocks:
  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: ---


Attachments

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

REPRODUCE:
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:
-----
{{setlist_start}}
This should be inside the divs!
{{setlist_end}}
-----

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

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

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:

http://mail.wikipedia.org/pipermail/mediawiki-l/2006-January/009858.html

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 
off.
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 (tmbw.net) 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.


Navigation
Links