User talk:Johan G/convert: Difference between revisions

→‎Architectural ideas: Some ideas to make the template a bit less of a monstrosity to develop, expand and maintain
No edit summary
(→‎Architectural ideas: Some ideas to make the template a bit less of a monstrosity to develop, expand and maintain)
 
Line 31: Line 31:


--[[User:Wkitty42|Wkitty42]] ([[User talk:Wkitty42|talk]]) 14:16, 5 August 2018 (EDT)
--[[User:Wkitty42|Wkitty42]] ([[User talk:Wkitty42|talk]]) 14:16, 5 August 2018 (EDT)
== Architectural ideas ==
Would using {{wikipedia|SI base units}} as intermediaries be more maintainable? In essence having subtemplates <code><nowiki>{{convert/from ''unit''}}</nowiki></code> to convert to for example convert from statute miles or ounces to meters or kilograms, and subtemplates <code><nowiki>{{convert/to ''unit''}}</nowiki></code> to for example convert those to nautical miles and pounds.
Possibly a <code><nowiki>{{convert/format}}</nowiki></code> subtemplate for handling decimal precision and whether or not the unit should be hidden.
Regarding parameters, it should be obvious that value, from-unit and to-unit is mandatory and could be unnamed parameters, but parameters for decimal precision and hiding the unit could just as well be named parameters ('''d''' for decimals and and '''h''' for hide unit perhaps).
—[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 18:31, 26 August 2019 (EDT)