[Mediawiki-l] Template is closing unclosed tag (e.g. DIV)

Tyler Rick tyler.rick at qualitysmith.com
Wed Jan 10 21:49:52 UTC 2007


Hi,

I see that there was some discussion about this back in 2006 Jan, but I 
haven't been able to locate a solution anywhere.

What I'm trying to do is to have a template {{Template:Header}} that 
has, say,
<div style="border: 1px solid red;">
and then a template {{Template:Footer}} that closes that div:
</div>

Then on my page I want to do this:
{{Template:Header}}
some content
{{Template:Footer}}

When I do this, it auto-closes the div before "some content", which is 
not what I want.

As other people have pointed out, it does work on the Wikimedia sites. 
(I did the exact same thing on http://www.mediawiki.org/wiki/Sandbox and 
it worked.)

In fact, 100s of portals use this technique on Wikipedia (see 
http://en.wikipedia.org/wiki/Portal:Mathematics, 
<http://en.wikipedia.org/wiki/Portal:Mathematics> 
Portal:Mathematics/box-footer-empty 
<http://en.wikipedia.org/wiki/Portal:Mathematics/box-footer-empty>, 
Portal:Mathematics/box-header 
<http://en.wikipedia.org/wiki/Portal:Mathematics/box-header>, for 
example) so I know it can be done.

I'm using the latest version and all (1.9) on my installation, so what 
does Wikipedia have set up differently that allows this?

If someone could tell me how to enable this (or disable auto-closing of 
unclosed tags, as the case may be), please let me know.

Thanks,
Tyler


> Hi crew,
>
> great to finally get a discussion on that topic.
>
> I of course see the point of fixing broken tags in templates to keep
> the generated HTML clean. But besides tags that are left unclosed
> accidentally, we have a real use case for this as we see for the box
> template.
>
> Since I'm not too long into wiki usage, the suggestion might be wrong,
> but maybe it could solve this issue: A flag that turns on/off the
> parser's "error handling" by adding something like __DO_NOT_FIX_TAGS__
> would be cool. Feasible or not?
>
> Thanks, Gerrit
>
> On 1/27/06, Rick DeNatale <rick.denatale at gmail.com <http://lists.wikimedia.org/mailman/listinfo/mediawiki-l>> wrote:
> >/ On 1/26/06, Brion Vibber <brion at pobox.com <http://lists.wikimedia.org/mailman/listinfo/mediawiki-l>> wrote:
> />/ > Rick DeNatale wrote:
> />/ > > On 1/26/06, Brion Vibber <brion at pobox.com <http://lists.wikimedia.org/mailman/listinfo/mediawiki-l>> wrote:
> />/ > >> Gerrit Quast wrote:
> />/ > >>> The problem is that for every template, mediawiki closes tags that
> />/ > >>> left open. The second template (only the closing DIV) is escaped and
> />/ > >>> appears as clear text.
> />/ > >> 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.
> />/ > >
> />/ > > Of course one man's bug is another feature.
> />/ >
> />/ > Well, that "feature" will break, badly, in future versions of MediaWiki which
> />/ > fix up the parser.
> />/
> />/ I don't use it myself, but when it breaks, it's going to break a LOT
> />/ of portal pages on wikipedia.
> />/
> />/ --
> />/ Rick DeNatale/




More information about the MediaWiki-l mailing list