[MediaWiki-l] Implementing Template Tolerant Tags

Jeff Evarts riventree at gmail.com
Thu Aug 22 16:31:32 UTC 2013

I try to avoid disturbing any of the wikimedia illuminati without doing my
homework first.

*Template Tolerant Tags*

I have a tag (<chem>) that changes raw text into html-marked-up text. I
want to be able to use it in a template:

   <includeonly>{| class="wikitable"
   !Chemical Formula

   - My first implementation of this project was in a *template*, but that
   turned out to be "the wrong thing" because I want to mark up raw text, not
   a series of prepartitioned parameters.

   - I can see that implementing a *magic word* might get me to where I
   want to go, but that seems both a little awkward and a little overkill,
   since that's for logical-flow/semantic stuff, and this is just syntax

   - Therefore I assumed (bad!) that *tags* would be the way to go.
   Ostensibly being markup, I thought that tags would be among the very last
   phases of the parser. Unfortunately for my project, it looks like they are
   among the first. After wrestling with the problem for a while, and
   including a call like this in my code:
      $parser->recursiveTagParse($raw, $frame);
   I still don't have a template-tolerant tag.

Tags operating on template parameters seems to be a common desire. Before
mailed this list directly I read:

   - Manual:Tag extensions<http://www.mediawiki.org/wiki/Manual:Tag_extensions>
   - Manual talk:Parser
   - How_do_I_render_wikitext_in_my_extension?<http://www.mediawiki.org/wiki/Manual:Tag_extensions#How_do_I_render_wikitext_in_my_extension.3F>
   - Erik's blog <http://meta.wikimedia.org/wiki/User:Eloquence>

and I have Googled all the variations of the below I can think of

[mediawiki custom tag parameter substitution]
 [mediawiki extension template parameter]

I cannot find any discussion on this topic *since 2011*. This indicates to
me that this problem is long solved, but I can't seem to track it down.

I am a compiler geek, so I understand phases of parsing, and the idea that
simply dropping my tag into this stream won't result in it getting properly
parsed by the browser - it has to be performed before the it's sent to the
browser, etc.

Wow, long preamble.

I have two and a half questions:

   1. How can I get simple parameter substitution done?
   2. Is there a "strategy" document somewhere that says: "Put
*these*things in tags, put
   *these* things in templates, and *these* things in magic words"?

   2a) If there isn't, why?

Thank you kindly for your time
-Jeff Evarts, a financial supporter of Wikipedia

More information about the MediaWiki-l mailing list