Hi,
There is an issue concerning unit conversions in wikitext: https://bugzilla.wikimedia.org/show_bug.cgi?id=235
This one doesn't deserved any attention since a long time. The original proposition was about converting units "on the fly" regarding user preferences. I don't know if it is feasible and/or desirable.
I propose to work on something less ambitious: adding a parser function to provide conversion - maybe in ParserFunction.
The idea would be something like: {{#unit: 1000 ft|m}} => <span title="304m (1000ft)">304m</span>
If I start working on this, will anyone accept to review the code?
Thanks in advance, Sylvain.
Why not just use http://en.wikipedia.org/wiki/Template:Convert ?
On Fri, Nov 20, 2009 at 06:04, Sylvain Leroux sylvain@chicoree.fr wrote:
Hi,
There is an issue concerning unit conversions in wikitext: https://bugzilla.wikimedia.org/show_bug.cgi?id=235
This one doesn't deserved any attention since a long time. The original proposition was about converting units "on the fly" regarding user preferences. I don't know if it is feasible and/or desirable.
I propose to work on something less ambitious: adding a parser function to provide conversion - maybe in ParserFunction.
The idea would be something like: {{#unit: 1000 ft|m}} => <span title="304m (1000ft)">304m</span>
If I start working on this, will anyone accept to review the code?
Thanks in advance, Sylvain.
-- sylvain@chicoree.fr http://www.chicoree.fr
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
{{Convert}} on Wikipedia isn't one single fancy template, it is actually several hundred. I ran Special:Export and told it to include all the sub template, and I got back a file with 394 pages, a few of them might be documentation, but you get the idea. I'd love to see this sort of functionality be put into MediaWiki somewhere, rather than crazy template hacking.
-Jon
PS. We tried to steal {{Convert}} on Wikipedia to use on Wikinews... we eventually gave up and stuck to the handful of separate templates we had before.
On Thu, Nov 19, 2009 at 22:05, Jona Christopher Sahnwaldt < jcsahnwaldt@gmail.com> wrote:
Why not just use http://en.wikipedia.org/wiki/Template:Convert ?
On Fri, Nov 20, 2009 at 06:04, Sylvain Leroux sylvain@chicoree.fr wrote:
Hi,
There is an issue concerning unit conversions in wikitext: https://bugzilla.wikimedia.org/show_bug.cgi?id=235
This one doesn't deserved any attention since a long time. The original proposition was about converting units "on the fly" regarding user
preferences.
I don't know if it is feasible and/or desirable.
I propose to work on something less ambitious: adding a parser function
to
provide conversion - maybe in ParserFunction.
The idea would be something like: {{#unit: 1000 ft|m}} => <span title="304m (1000ft)">304m</span>
If I start working on this, will anyone accept to review the code?
Thanks in advance, Sylvain.
-- sylvain@chicoree.fr http://www.chicoree.fr
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Fri, Nov 20, 2009 at 12:04 AM, Sylvain Leroux sylvain@chicoree.fr wrote:
The idea would be something like: {{#unit: 1000 ft|m}} => <span title="304m (1000ft)">304m</span>
It would make more sense to have it output simply "304". That way it could be effectively used in a template to achieve any desired formatting.
First of all, thanks for your replies.
In short, in my first message, I failed to explain the targeted use case - which has somehow moved away from BUG-235. So here it is: o I was targeting general MediaWiki wikis, not necessary Wikipedia o My primary concern was to allow an administrator to easily add support for conversion. Without relying on the end-users (the "contributors") good will or technical knowledge.
Now for the long answer.
wiki@konsoletek.com wrote:
{{Convert}} on Wikipedia isn't one single fancy template, it is actually several hundred.
I think it is actually several hundred with the new design (as of NOV-2009), but the old design was requiring several thousands (!) templates. According to [1] with the new design "new options could be implemented by changing just a few subtemplates, rather than hundreds at a time".
jcsahnwaldt@gmail.com wrote:
Why not just use http://en.wikipedia.org/wiki/Template:Convert ?
On its side, {{Convert}} has the advantage of being able to convert many different things. Keeping it with the vast diversity of knowledge carried by wikipedia (from converting musical notes to pitch [3] to converting weapon calibres [4], all of this with several different algorithms). Moreover, by working at "template level", any contributor is able to edit/update/fix it. Without requiring any special privilege.
Someone may argue that it has its own drawbacks[2], but anyway Wikipedia is a special case: it has enough manpower to fix and/or update both this template and the articles that uses (or should use) it.
This is simply not the case for the general MediaWiki user. I think of one "in house" wiki that requires handling of some fancy units. Like expressing quantities as kibibytes as well as kilobytes. Or express throughput as bytes/s or bits/s. Eventually using those values for producing embedded graphics. I don't think those units are supported by {{Convert}} now, and the point is that it requires a substantial amount of work for a non-specialist of that template to add support for them. For small wikis, I think it is more effective to let the administrator install a new extension or edit a few lines of PHP to provide the support for a new conversion.
Aryeh Gregor Simetrical+wikilist@gmail.com wrote:
The idea would be something like:
{{#unit: 1000 ft|m}} => <span title="304m (1000ft)">304m</span>
It would make more sense to have it output simply "304". That way it could be effectively used in a template to achieve any desired formatting.
I agree with that. In order to be effectively used in template, the "converter" should only perform the conversion and let the formating at the caller's charge.
Last, but not least, I spend a few hours this WE working on a prototype. It sounds promising. I intend to upload a demo in the following hours.
Best regards, Sylvain.
---- [1] http://en.wikipedia.org/wiki/Wikipedia:A_plan_to_reduce_Convert_subtemplates [2] http://en.wikipedia.org/wiki/Wikipedia:Analysis_of_Template:Convert_problems [3] http://en.wikipedia.org/wiki/Template:Convert/note [4] http://en.wikipedia.org/wiki/Template:Convert/calibre
Aryeh Gregor a écrit :
On Fri, Nov 20, 2009 at 12:04 AM, Sylvain Leroux sylvain@chicoree.fr wrote:
The idea would be something like: {{#unit: 1000 ft|m}} => <span title="304m (1000ft)">304m</span>
It would make more sense to have it output simply "304". That way it could be effectively used in a template to achieve any desired formatting.
_______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
Here is a demo of the current prototype: http://www.chicoree.fr/w/UConvert
As you will see, the core functionalities are here. Since my objective was to have a working version quickly, I need to spend some time now to clean-up the code before releasing an alpha version.
Sylvain.
wikitech-l@lists.wikimedia.org