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

Robert Rohde rarohde at gmail.com
Tue Jul 7 04:11:41 UTC 2009


On Tue, Jun 30, 2009 at 8:16 PM, Robert Rohde<rarohde at gmail.com> wrote:
<snip>
> An idea that has been toyed with a couple of other places is to allow
> defined blocks and references to them in article text.  For example:
>
> An article might start:
>
> <display name="infobox" />
> Thomas Jefferson was the third president...
>
> and at the end of the article have:
>
> <define name="infobox">
> {{infobox
> ...
> }}
> </define>
>
> It would provide the flexibility to place items where needed in the
> article while moving the complex wikicode into a separate segment
> that's less likely to confuse novices.  One could also call <display>
> multiple times if there is an element (like a birth date) that needs
> to be repeated in some awkward manner.

Returning to a chunk of discussion from last week...

I wrote code as Extension:DelayedDefinition that actually implements
the <define> and <display> system suggested previously.  I'm not sure
the WMF editing communities would actual want to go this way though.
It's a pretty drastic step from the point of wikicode layout and a
good WYSIWYG would be a better long-term solution to the same problem,
so it may have been something of an academic exercise.

Also, there is an enormous hack in the middle of it where it makes a
recursive call to Parser::parse (labeled with screaming comments).  I
realize doing that is the height of all evil, but the existing
recursiveTagParse, Hooks, and similar don't actually seem to offer
enough control to make this work properly.  So, if someone were ever
to actually consider this for production use, the parser would
probably need to be patched to allow a more appropriate solution.

-Robert Rohde



More information about the foundation-l mailing list