:/ I need to remember to use Reply to all on these sf lists.
Well, actually it's not just the US, and not just imperial.
For my use,  it's on the Narutopedia. The databooks (Japanese ones) use
the #'#" format, so I wanted to be able to let users just input the
sizes in the same format as the databook instead of doing any math, or
adding in any extra string and expression functions just for that.
You also have to think about time... Not a point in time, but a length
of time. A common response to the question "How long is that going to
take?" will not be 90 min, or even 1.5 hours, it will be 1 hour and 30
minutes, or at least 1 hour 30 minutes. So that in itself would be a
nice reason to support multiple values. In addition to historical data
which still uses old numeric formats.

I was actually thinking of allowing separators for separating data
(space, comma, etc...) and an Allows format built in parameter for
special cases.
So for the "# ft #in" you'd allow space, for the "# ft, #in" you'd allow
comma, and even for "1 hour and 30 minutes" you could allow 'and' as a
separator.
Then you would use [[Allows format::#'#"]] and it would recognize
something with the regex /(\d+)(')(\d+)(")/ where every odd is a digit,
and every even equivalent is something it checks the list of available
units for.

Though I suppose I should come up with a better thought so that it could
support things like "##:##" and recognize it as hours:minutes.

~Daniel Friesen(Dantman) of:
-The Gaiapedia (http://gaia.wikia.com)
-Wikia ACG on Wikia.com (http://wikia.com/wiki/Wikia_ACG)
-and Wiki-Tools.com (http://wiki-tools.com)

S Page wrote:
> DanTMan wrote:
>> Has anyone attempted to get SMW to support special types of number 
>> notation, basically where multiple numbers of different units are 
>> written out.
>>
>> Basically such as [2ft 5in] or the classic format [2'5"]
>
> Nobody as far as I know.
>
> You could write a custom datavalue that parses it, similar to 
> SMW_DV_GeoCoords.php.  Trying to add it into SMW_DV_Linear.php to give 
> you unit conversion would be challenging, as SMWLinearValue just 
> relies on SMWNumberValue's parsing.  Maybe you'd parse once to get 
> (value=2, unit="ft 5 in"), then notice that convertToMainUnit() fails, 
> so parse again to see if there's a second value.
>
> It would be a lot easier to support multiple units only in display, 
> something like
>   [[display units::"%dft %.2fin", meters, km]]
> and you'd beef up SMWLinearValue->makeConversionValues() to parse this 
> sprintf-like format.
>
> FWIW the GNU units program http://www.gnu.org/software/units/ , the 
> most impressive conversion program I've found, doesn't attempt 
> multiple units, nor does Java JSR-275 (units).  Come on United States, 
> Liberia, and Myanmar, get with metrication ;-)
>
> -- 
> =S Page
>


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to