[Mediawiki-l] template weirdness

Rowan Collins rowan.collins at gmail.com
Sun Apr 24 15:55:12 UTC 2005


On 4/24/05, Jan Steinman <Jan at bytesmiths.com> wrote:
> Do templates force-close any opening tags?

I was under the impression that they don't get manipulated at all, and
that various current uses exploit this fact. If we ever move to a
"proper" grammar-based parser, this is a potential problem, because it
will prevent templates being cached as pre-parsed segments, but for
now, it's fine.

A nice simple example, similar to what you're trying, is
http://en.wikipedia.org/wiki/Template:Vfd_top and
http://en.wikipedia.org/wiki/Template:Vfd_bottom - the first opens a
div, the second closes it.
 
> But it looks like the {{menu top}} is getting closed off with
> "</font></p></div>", even though I did no such thing.

Are you looking at the source of just the template page on its own,
out of context? Or perhaps including just the {{menu top}} without the
{{menu bottom}}? Your browser (and possibly a call to "htmltidy"
within MediaWiki) will tend to close any elements that are "left
hanging", so you will probably never see a page with <div> but no
</div>. Once you include the "</div>" yourself, however, the code
won't need tidying in this way, so won't be messed with.

In other words, if you actually use both {{menu top}} and {{menu
bottom}} in a page, as you describe, it *should* work just fine.

-- 
Rowan Collins BSc
[IMSoP]



More information about the MediaWiki-l mailing list