On 02/02/12 18:38, Gabriel Wicke wrote:
Higher-level features can be represented in the HTML DOM using different extension mechanisms:
- Introduce custom elements with specific attributes: <template href="Template:Bla' args=".../>
You mean <mw:template href="Template:Bla' args=".../> :-)
- Expand higher-level features to their presentational DOM, but identify and annotate the result using custom attributes. (...)
Unused arguments (which are not found in the template expansion) or unexpanded templates can be represented using non-displaying meta elements:
<div itemscope itemtype='http://en.wikipedia.org/wiki/Template:Sometemplate' id='uid-1' > <h2>A static header from the template</h2> <!-- The template argument 'name', expanded in the template --> <p itemprop='name' content='The wikitext name'>The rendered name</p> <meta itemprop='firstname' content='The wikitext firstname'> </div>
The <p> item looks wrong, in microdata it wouldn't have the content attribute. Its value instead would be 'The rendered name'. Extracting the wikitext from there instead of a copy of the inner wikitext shouldn't be a problem, though. As far as it doesn't contain unbalanced syntax... (but that's a point where it seems safe to break compatibility).
I think it would look more like: <div itemscope itemtype='http://en.wikipedia.org/wiki/Template:Sometemplate'> <h1 itemprop="name">John Doe</h1> <p>Name: <span itemprop="name">John Doe</span></p> <p>Age: <span itemprop="age">21</span></p> </div>
And indeed it would look very cool to in-place edit the age, or name. But remember that it should be changing both locations!
However, it doesn't seem so easy for other items: [[Image:Photo of {{{name}}}.jpg|120px]]
{{#ifexist: {{{name}}} family| [[{{{name}}} family]] }}
{{#if: {{{wife|}}} | Married with [[{{{wife}}}]] | Single }}
As soon as it hits unrepresentable syntax, I think it should disable visual modification of that template. It's better to force editing of parameters than have the user that added the middle name, make the photo disappear after saving (but showed when he clicked save).