Page MenuHomePhabricator

Rendering of Type:Number
Closed, ResolvedPublic

Description

Author: mediawiki-bugzilla

Description:
Type:Number takes plain numbers like 14925490, but always renders it as 14,925,490 in queries. This makes it necessary to add an extra processing step which strips the commata from semantic query results for templates that expect to work with numbers. Please add an option to get a "plain" number.

MediaWiki 1.14.0
PHP 5.2.4-2ubuntu5.6 (apache2handler)
MySQL 5.0.51a-3ubuntu5.4

Semantic MediaWiki (Version 1.4.2)
Semantic Forms (Version 1.6)


Version: unspecified
Severity: normal

Details

Reference
bz19086

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:42 PM
bzimport set Reference to bz19086.

A new feature is provided to address this in the next release (currently available in SVN). By specifying "-" or "" (empty string) as an output format in queries, outputs are returned in plain, unformatted form. Example query:

{{#ask: [[Category:Country]]

?area#km²
?population#
?capital#-

}}

will return a table of four columns, all of which have an explicit output format (the content after #). The first column are simply the countries, the second is their area converted to "km²" as usual. The third one is their population as a plain string (caveat: when numbers get large, scientific notation is used; fixes for preventing this are welcome). The fourth column is their capital, again as a plain (unlinked) string. Empty format strings and "-" mean the same. Spaces are ignored.

For switching off all links (even in the first column), one can set the parameter "link=none" or replace the first standard column with a new version by adding the parameter "mainlabel=-" (hide first column) and the new printout "?#" (display main column, with empty formatting string).