[Foundation-l] [Wikitech-l] On templates and programming languages

Brian Brian.Mingus at colorado.edu
Wed Jul 1 01:54:09 UTC 2009


On Tue, Jun 30, 2009 at 10:16 AM, Brion Vibber<brion at wikimedia.org> wrote:
> As many folks have noted, our current templating system works ok for
> simple things, but doesn't scale well -- even moderately complex
> conditionals or text-munging will quickly turn your template source into
> what appears to be line noise.

In addition to changing the programming language that is used in the
template namespace a lot of progress can be made on the readability of
articles (and thus how usable they are) by rethinking how we invoke
templates, or rather how we make data available to templates.

If you look at the George W. Bush article you see that the first 50
lines of the article are template code and that his birthday is
declared multiple times like so:

|birth_date={{birth date and age|mf=yes|1946|7|6}}
born July 6, 1946
|DATE OF BIRTH=July 6, 1946

Editors clearly need a better system for declaring facts about
articles and then using them in advanced template programming. One can
imagine an alternate system where his birthday is only declared once,
like so, in the article text: born on [[birthday::July 6, 1946]]. And
so on for all the other facts listed in his infobox. Rather than
declaring them explicitly in the infobox, you declare them explicitly
inline in the text in a highly readable format.

Then there is the issue of calling templates. Where do you place them
within the article? Much like MediaWiki itself I suggest we introduce
the notion of hooks. Beginning of article, end of article. Beginning
of section, end of section. Beginning of paragraph end of paragraph.
Template programmers can use these hooks to inject data that is
declared explicitly in the article into various points of the article.

This can be thought of as a separation of content and presentation.
Articles have the constraint that their source code must, under all
circumstances, be highly readable to our visitors. That way our
visitors might become encyclopedia writers! Associated with those
articles is another page where users can control higher level
organizations of the content in the body of text. They can format it
in infobox style, process it any way they like using our new
programming language, and place it in a variety of locations
throughout the article without sacrificing the readability of the
wikitext at all.

It will take a little bit more conceptual work to handle all cases,
such as inline references, etc.., etc... But the bottom line is that
the source code to articles on Wikipedia has become so complicated
that it is now too difficult for reasonable people to consider
editing. One user said that adding a new programming language to
MediaWiki is totally orthogonal to the method that we use to pass data
to those programs, or the context in which those programs are called.
I couldn't disagree more - one of the major reasons Wikipedia is so
unreadable today is because of the way we call templates from
articles. From the bottom of the design to the top, it needs to be
rethought. I believe that this conversation should be held far beyond
wikitech-l and should be made available to subscribers of almost all
of our lists and also the large pool of contributors. One of the
reasons that we ended up with ParserFunctions is that very few people
were involved in the conversation. Do we even understand the problem
that needs to be solved? I am not convinced that it has been
adequately characterized.



More information about the foundation-l mailing list