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