On 22/05/12 15:49, Daniel Kinzler wrote:
On 22.05.2012 15:15, Nikola Smolenski wrote:
Rather, I would include a template normally and
use a parser function within the
template to access the data.
So, that would be option (2) from above.
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.
How would you specify which item {{#data:}} refers to, in case it's not the
articles "default" item? How would you pass multiple items to a template?
I see multiple possibilities:
{{#data:color|item=Blah}} - this uses item linked to "Blah" in the local
language.
{{#data:color|item=en:Blah}} - this uses item linked to "Blah" in
English language.
{{#data:color|id=q123}} - this uses item with ID q123.
{{#data:Blah->color}} - we can do this since -> can't appear in a page
name - this is my favorite of course :)
Every template or article could read any item without the need to pass it.
If this is needed, one can always use the
{{#data-value}} function with
source=ACME_SURVEY_2010 (perhaps 'ref' is better than 'source').
By the way, in some cases a single assertion might have multiple
sources, also a single source might support multiple assertions, this
needs to be taken into account.
The parser
function should be able to override itself by template parameters - I
believe it is possible to do this.
That makes the hair in my neck stand up :)
From the user point of view or the implementation point of view? :)
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.
The parameter syntax is the simply way to access property values. For all fancy
needs, like picking the language, use {{#data-value}} instead. Basically, the
{{{data.foo}}} syntax is just a shorthand for the more powerful {{#data-value}}
stuff.
The problem is that we are going to pre-load all the data of an item
before the article renders, right? So now we need to pre-load all the
data in all the languages.
If there will be no pre-loading, disregard this.
Except that it's not wrapped in any HTML. Perhaps
there should be an option to
{{#data-value}} to turn that off completely, using form=plain or some such.
Now shorten #data-value to #data, use form=plain as the default and
that's it :)
{{#data-link:data|the data item}}
Why not the usual interwiki syntax of [[wikidata:data|the data item]]?
because "data" is not an identifier for that item on the wikidata repo. YOu
would have to use something like:
[[wikidata:/id/{{{data.id}}}|the data item]]
But constructing edit links this way is very cumbersome. The main intend for
this function is to make it easy to provide an edit link in the infobox.
But perhaps a different syntax should be used for this. After all, the edit link
would, with javascript enabled, not really be a link, but a button to activate
the on-site editing feature.
I would try not to introduce new syntax if it is not necessary. How
about this:
[[wikidata:Berlin]] - links to
en.wikidata.org/wiki/Berlin
[[wikidataid:q1234]] - links to
en.wikidata.org/id/q1234
{{canonicalurl:wikidata:Berlin|action=edit}} - links to edit page
All of this syntax already exists, is widely used and could be
introduced without additional coding :)