[Foundation-l] Help needed to fix broken templates

Tim Starling tstarling at wikimedia.org
Thu Jan 17 13:34:16 UTC 2008


(Cross-posting to wikitech-l and foundation-l, I suggest replying on 
wikitech-l.)

All known bugs in the new preprocessor have been fixed. So it's now time 
to enable it on Wikimedia. Unfortunately, a lot of articles and templates 
rely on bugs in the old parser, and ideally they should be fixed before 
the switchover.

We'll be aiming to switch to the new preprocessor on the 24th of January.

For technical background information about this project see my first post 
on this subject:

http://lists.wikimedia.org/pipermail/wikitech-l/2007-November/035154.html

Over the past few days, Splarka and MZMcBride have been putting in a great 
deal of work to beta test the new parser, by checking articles on the 
English Wikipedia and several other wikis for any changes. Between the 
three of us, we've built up extensive documentation of the commonly-seen 
differences between the old and new parsers, and we've identified and 
fixed eight distinct bugs in the new parser.

http://meta.wikimedia.org/wiki/Migration_to_the_new_preprocessor

We'd now like to invite the rest of the community to help.

This post is just a brief summary of the wiki page, please go there to 
find out more.


The two most common problems with existing articles are comments after 
headings, and abuse of bug 5678. Here's a comment after a heading:

== Heading == <!-- that was a heading -->

This will still make a heading in the new preprocessor, but it won't make 
a section edit link. In the old parser, it does make a section edit link. 
This change was done to resolve various incarnations of bug 4899, i.e. 
mismatches between the section edit link and the section you end up editing.

Bug 5678 is a cluster of problems associated with double-parsing of the 
results of parser functions. It's often reported and causes a great deal 
of distress. But since the standard way to find out how to write wikitext 
is to try it and see what works, many people have inadvertently utilised 
behaviour arising from this bug to do various things.

A typical example is misuse of {{!}} to separate template parameters, as in:

{{#if:1| {{template{{!}}parameter}} }}

In the new preprocessor, {{!}} can never be used to separate parameters.
The fact that it was possible in the old parser in certain circumstances 
was an accident.

Please see [[m:Migration to the new preprocessor]] for information about 
how you can find and fix these problems.



I have introduced two cool new parser features to help ease the pain: 
{{#tag:}} and {{#iferror:}}. #tag allows you to invoke XML-style tags such 
as <ref> with syntax similar to parser functions, with full access to 
template parameters. For example:

{{#tag:ref|[{{{url}}} {{{text}}}]}}

This is equivalent to:

<ref>[{{{url}}} {{{text}}}]</ref>

except that it works. You can also use #tag to call <imagemap> and 
<gallery>. #tag is a core parser function with a slightly different syntax 
to the one used by the TagParser extension. It is intended for use in 
meta-templates where the simpler XML-style syntax is not sufficiently 
versatile.

#iferror detects error return codes from #time and #expr. It is part of 
the ParserFunctions extension.

-- Tim Starling



More information about the foundation-l mailing list