Difference between revisions of "Template:Coord/input/dec/sandbox"

From blackwiki
Jump to navigation Jump to search
imported>Stepheng3
(rm impossible case)
imported>Stepheng3
(move test up one level, whitespace for readability)
Line 1: Line 1:
<includeonly>{{#if:{{{1}}}|{{#if:{{{2}}}|{{Coord/link|dms-lat={{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}|dms-long={{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}|dec-lat={{{1}}}|dec-long={{{2}}}|param={{{1}}}_N_{{{2}}}_E_{{{3}}}|default={{#if:{{{format|}}}|{{{format}}}|dec}}|name={{{name|}}}}}<!--  
+
<includeonly>{{#ifeq:{{{2}}}||{{Coord/input/error2|msg=missing longitude (dec format)|sort_ch=#}}|{{Coord/link
 +
|dec-lat={{{1}}}
 +
|dec-long={{{2}}}
 +
|dms-lat={{coord/dec2dms|{{{1}}}|N|S|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
 +
|dms-long={{coord/dec2dms|{{{2}}}|E|W|{{coord/prec dec|{{{1}}}|{{{2}}}}}}}
 +
|param={{{1}}}_N_{{{2}}}_E_{{{3}}}
 +
|default={{#if:{{{format|}}}|{{{format}}}|dec}}
 +
|name={{{name|}}}}}<!--  
 
  -->{{#if:{{#switch:{{{3}}}{{{6}}}|NE|NW|SE|SW=y}}|{{Coord/input/error2|msg=missing longitude (dm format)|sort_ch=#}}}}<!--  
 
  -->{{#if:{{#switch:{{{3}}}{{{6}}}|NE|NW|SE|SW=y}}|{{Coord/input/error2|msg=missing longitude (dm format)|sort_ch=#}}}}<!--  
  -->{{#ifexpr:{{{1}}}>90|{{Coord/input/error2|msg=latd>90 (dec format)|sort_ch=>}}}}<!--  
+
  -->{{#ifexpr:0{{{1}}}>90|{{Coord/input/error2|msg=latd>90 (dec format)|sort_ch=>}}}}<!--  
  -->{{#ifexpr:{{{1}}}<-90|{{Coord/input/error2|msg=latd<-90 (dec format)|sort_ch=<}}}}<!--  
+
  -->{{#ifexpr:0{{{1}}}<-90|{{Coord/input/error2|msg=latd<-90 (dec format)|sort_ch=<}}}}<!--  
 
  -->{{#ifexpr:{{{2}}}<360||{{Coord/input/error2|msg=longd>=360 (dec format)|sort_ch=>}}}}<!--  
 
  -->{{#ifexpr:{{{2}}}<360||{{Coord/input/error2|msg=longd>=360 (dec format)|sort_ch=>}}}}<!--  
 
  -->{{#ifexpr:{{{2}}}>-360||{{Coord/input/error2|msg=longd<=-360 (dec format)|sort_ch=<}}}}<!--  
 
  -->{{#ifexpr:{{{2}}}>-360||{{Coord/input/error2|msg=longd<=-360 (dec format)|sort_ch=<}}}}<!--  
  -->|{{Coord/input/error2|msg=missing longitude (dec format)|sort_ch=#}}}}}}<!--
+
  -->}}<!--
 
  --></includeonly><noinclude>
 
  --></includeonly><noinclude>
 
{{documentation|Template:Coord/sub doc}}
 
{{documentation|Template:Coord/sub doc}}
 
[[Category:Coord template]]
 
[[Category:Coord template]]
 
</noinclude>
 
</noinclude>

Revision as of 00:52, 23 April 2010

Template documentation[view] [edit] [history] [purge]

The following templates are "subroutines" of {{Coord}}. Separating them out drastically reduces the pre-expand size of {{Coord}}. They shouldn't be invoked directly.

name function
{{Coord/display/inline}} displays coordinates inline
{{Coord/display/inline,title}} displays coordinates inline and above the article
{{Coord/display/title}} displays coordinates above the article (generally to the right of the article's title)
{{Coord/link}} generates microformats and link to GeoHack
{{Coord/input/dec}} reads coordinates in decimal degrees {{Coord|12|-12}}
{{Coord/input/d}} reads coordinates in decimal degrees with directional letters {{Coord|12|N|12|W}}
{{Coord/input/dm}} reads coordinates in degrees/minutes format {{Coord|12|12|N|12|12|W}}
{{Coord/input/dms}} reads coordinates in degrees/minutes/seconds format {{Coord|12|12|12|N|12|12|12|W}}
{{Coord/input/ERROR}} generates error message if the inputs do not match any of the above formats
{{Coord/input/error2}} generates error message for range checks and such
{{Coord/input/nolat}} generates error message for missing latitude
{{Coord/negzeropad}} pads a positive number with trailing zeroes until it matches the precision of a negative number
{{Coord/prec dec}} selects a format for converting decimal degrees, based on the precision of the inputs