On 22.05.2012 15:08, Jérémie Roquet wrote:
I've some questions about the design proposed in
this draft. I'm not
sure these are actual issues, but I prefer to be sure ;-)
i. It seems to me that the proposed design implies that any access to
data is done through a template transclusion, which could be fine for
the given example (ie. infoboxes — though I'll raise another issue
below, see ii.) but AFAIU forbids direct use of data in an article. Is
this a desirable limitation? Or did I miss something?
I considered this a small price to pay (it's an uncommon use case, as the
experience with SMW shows - people use templates for this sort of thing).
But it's easy enough to overcome this limitation, see me reply to Nikola.
ii. I understand that only one item can be included at
once (either by
using the data_item attribute or the article links).
Only one item can be formated by a given template call. Multiple items can be
included on the same page, using the same or different templates for formatting.
What if for some
reason we want a template that accesses several items? Is it
reasonable to assume that there will always be an item that links to
every needed item for a given template?
In the Wikipedia use case which is the basis for our spec, yes. Because the
items are per definition describing the same thing that the Wikipedia page
describes.
Even for other use cases, I can hardly imagine when multiple items should be
passed to a single template. Templates are made to provide uniform formatting
for objects with similar properties. They are essentially views on specific
types of items.
But again, this limitation is easy enough to overcome, see my reply to Nikola.
iii. Articles on current wikis use templates named
(eg.) “{{Infobox…”.
Shouldn't it be a prerequisite for templates using Wikidata to (be
able to) keep the same name, so that:
The templates can have any name, wikidata/wikibase doesn't care. "infobox"
was
just an example. There can be any number of such templates on the client wikis,
for formating different things in different ways.
- we don't have to run bots on every single
article only to prepend
“#data-template:” but just have to update the template? Arguably, we
would have to edit the articles anyway to remove attributes that are
handled by Wikidata; just to be sure.
Editing of every article *will* be necessary. I see no way past this. Whether
that edit introduces a simpler template rederence, or a parser function call, is
yet to be decided.
- people don't massively reject the transition to
Wikidata because of
the /visible/ syntax change.
Well, there will be massive changes to the article, to wit, removal of all the
infobox parameters.
Do you think putting a parser function call directly into the article would be
considered far worse than a simple template call? I.e. is
{{Infobox}}
really so much better than
{{#data-template:Infobox}}
?
I would actually prefer the latter, because it is more obvious, less magic
happening invisibly in the background.
But if need be, it's easy enough to hide that call: if the Infobox template is
smart, and when called without any parameters, calls {{#data-template:Infobox}}.
So in the article, you'd just see {{Infobox}}.
The same can of course also be done by using a "top level" template for hiding
the parser function (e.g. Infobox) separate from the real template (e.g.
Infobox-format or whatever), which would be used with
{{#data-template:Infobox-format}} by the Infobox template.
iv. Per i., ii. and iii., wouldn't it be desirable
to have some syntax
to access an item without relying on template transclusion?
As i said in i., i think that's a rare use case. However, it's simple enough to
provide this ability, see my reply to Nikola.
This would
enable us to:
- use data in an article without having to write a template first (solves i.);
Hm, actually - this might be nice for using values from the item inline in the
article text. But do we really want to encourage that?
- write templates that can get as many items as they
need, either
from the transcluding page or /by themselves/ (solves ii.);
Well, I don't like magic going on in the background, so I don't really like
templates fetching item data by themselves.
But if need be, my suggestion to provide a {{#load-data}} function that puts an
item into the current scope (be it the page or a template) would solve this too.
- update the existing templates to Wikidata without
having to edit
the articles and without visible changes from the template user's
perspective — except for what is handled by Wikidata, of course
(solves iii.).
This is always possible. Keep the current template as is, move the actual
formating logic to another template, make the original template call the
{{#data-template}} function.
v. What about lua? :)
Parser functions are available for use from Lua, afaik. Once we know more about
how Lua will bind into MediaWiki, we can think about nice shorthands and pretty
syntax.
Thanks for your input!
-- daniel
--
Daniel Kinzler, Softwarearchitekt
Wikimedia Deutschland e.V. | Eisenacher Straße 2 | 10777 Berlin
http://wikimedia.de | Tel. (030) 219 158 260
Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e.V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg
unter der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt
für Körperschaften I Berlin, Steuernummer 27/681/51985.