On 22/05/12 13:47, Daniel Kinzler wrote:
I have created a first preliminary draft of how data
items from the Wikidata
repository may be accessed and rendered on the client wiki, e.g. to make infoboxes.
https://meta.wikimedia.org/wiki/Wikidata/Notes/Inclusion_syntax
It would be great if you could have a look and let us know about any
unclarities, omissions, or other flaws - and of course about your ideas of how
to do this.
As could perhaps be guessed, I have a lot of comments :)
Including Items in an Article:
{{#data-template:Infobox
|data_item=q332211
|data_param=stuff
|foo=some value
|stuff.color=green
}}
I see no reason for creating a new parser function for inclusion of
templates. Also, this syntax would not allow a template to draw data
from more than one item, which would probably be a requirement in phase3.
Rather, I would include a template normally and use a parser function
within the template to access the data.
So, instead of {{{data}}} there would be {{#data:}}, instead of
{{{data.color}}} there would be {{#data:color}}, instead of
{{{data.color(ACME_SURVEY_2010)}}} there would be
{{#data:color|ref=ACME_SURVEY_2010}} and so on.
One advantage is that commonly used syntax is always used, instead of
inventing new syntax (as for the reference in this example).
Another advantage, this way would make data usable directly in article
text, if that is wanted.
The parser function should be able to override itself by template
parameters - I believe it is possible to do this.
Unrelated to the above,
"This will return the value of the color property, in the page's content
language, as plain text."
I see that there is need to also select desired content language (for
example, a lot of infoboxes display name of the topic in the content
language and in the topic's language(s)). This has the potential to
introduce additional problems, of course.
Formatting Functions:
{{#data-value:data.color}}
form
Specifies in what form rendered, that is, in which HTML element the
value should be wrapped.
span: wrap in <span> tags, use <span> tags for parts
div: wrap in <div> tags, use <span> tags for parts
li: wrap in <li> tags, use <span> tags for parts
I don't like this at all, since it limits the number of possibilities,
introduces yet another syntax parallel to HTML.
Yet, I don't see anything much better. A half-baked idea is to leave it
to the client wikis to create their data display templates that could be
used to format data appropriately.
(I see Jérémie's email now, and see that we came independently to some
of the same conclusions :) )
{{#data-values}}:
But this is of course an even worse problem.
{{#data-link:data|the data item}}
Why not the usual interwiki syntax of [[wikidata:data|the data item]]?