[OGDev] Templating

Earle Martin openguides at downlode.org
Mon Apr 3 18:25:59 BST 2006


Talking to Chris Schmidt on IRC at the moment about macros. He's just coded
up @INCLUDE [[Foo]] to include the whole content of "Foo". I was saying that
it would be nice to have templates much the way MediaWiki does. He said:

"Just specify that @TEMPLATE (Template:Fillin|Variable1|Variable2) will load
?id=Template:Fillin, and replace Variable1 with the content of variable1".

As I understand it you could just pass any number of variables into a
template call, effectively giving each template its own @_.

He continued: "The biggest problem is picking a syntax that won't cause
other problems. Most of the current macros use [[ ]] but that results in it 
being treated as a link so you get lots of extra backlinks."

I commented that we could use {{}} for templates instead - again, following
the MediaWiki model - and avoid this. We could also drop the "@TEMPLATE"
prefix which would be unnecessary. I'd actually like to deprecate all the
@THING prefixes if at all possible and use {{}} markup. Here are some
suggestions:

* {{index_link}} = "@INDEX_LINK [[Cat or Loc You're Looking At]]", likewise
  for {{index_list}}.
* {{index_link|Category Foo}} = "@INDEX_LINK [[Category Foo]]" variable
  being passed in as mentioned above.
  
index_link and index_list are obviously reserved words as builtins so you
shouldn't be able to define templates called that.

Thoughts?

-- 
Earle Martin
            http://downlode.org/
http://purl.org/net/earlemartin/



More information about the OpenGuides-Dev mailing list