On Fri, 03 Feb 2012 00:20:14 -0800, Gabriel Wicke wicke@wikidev.net wrote:
Got a more verbose example of what could go wrong with an example so I can follow up with an example of how it could be done? Or more to the point. Got something I could look over on how you intended to model this in a way that wasn't based on syntax, so I can make a better example in context?
Template arguments, and especially the named variant, tend to have some loosely defined semantics apart from their syntactic identifier. These semantics are often explained in the template's documentation section, and can be mapped to a more formal ontology as in dbpedia [1].
A general schema for all templates could only reference things like the argument position or the argument name in an abstract way, but could not generally provide semantics for them. Note that this is different for things like images, where we can either define our own global schema, or directly reuse one from schema.org (e.g. http://schema.org/MediaObject), possibly with an additional extension for disambiguation purposes (/MW) as described in http://schema.org/docs/extension.html.
itemtype is really a meant for a real type, I'd really hate to see Microdata abused to the point where we abuse itemtype as a reference url and pretend that half of everything using itemtype comes from wiki syntax rather than a user entering microdata into WikiText.
Microdata items can be nested, so I don't see a problem with users or templates providing a mapping to more specific schemas like those of schema.org. Clashes of user-provided itemtypes with those used for editing purposes need to be prevented in the parser, but that is doable. Consumers are free to ignore itemtypes they don't know about, which is what Google etc are doing afaik- and what also motivated them to set up schema.org in the first place.
There might be ways to use schema information from the template documentation to add an additional, more general itemtype to the rendered template, but that is both still under development at WhatWG and not our highest priority right now.
Gabriel
Hmmm... wait now I'm confused, are we talking about a Microdata DOM output that the Parser generates from WikiText. Or a completely tailored one where the template itself is authored in Microdata so that it can describe how a Visual Editor should edit it?
If you're talking about the latter, then I can almost understand itemtype being the template itself, and the transclusion describing the data according to that.
Though if you're talking about the former, and are talking about replacing {{{name}}} in Template:Foo transcluded by {{Foo|name=bar}} with <span itemprop="name">bar</span>. Then I'm saying that I don't like itemtype being abused to be the template name and itemname being abused to be the template argument name and instead of the template name and parameter names being abused as the schema of the template having a more verbose proper set of Microdata to describe it: # Template:Foo {{{bar}}}
# Page content {{Foo|bar=baz}}
# Result <div itemscope itemtype="http://www.mediawiki.org/microdata/wikitext/Transclusion" id='uid-1'> <meta itemprop="PageTitle" content="Template:Foo"> <div itemprop="Argument" itemscope itemtype="http://www.mediawiki.org/microdata/wikitext/Argument"> <meta itemprop="Name" content="bar"> <span itemprop="Content">baz</span> </div> </div>
Maybe it would be easier to understand if our examples were a complete set of page content input WikiText, template content input WikiText, and the output DOM what we expect. Perhaps also what the intended goal is. I'm not quite sure if we're trying to describe templates in a way that the VisualEditor can extract the parameters from, edit them inline (if possible), or describe the output of a template in a way that can be read by machines for some separate purpose.