Template:Coords: Difference between revisions

From Unofficial Homecoming Wiki
Jump to navigation Jump to search
imported>Sekoia
(updating to use {{nobr}}. also trying to add support for x=|y=|z=; also updating documentation some)
m (span instead of nobr template for performance?)
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{nobr|({{{x|{{{1}}}}}}, {{{y|{{{2}}}}}}, {{{z|{{{3}}}}}})}}<noinclude>
<includeonly><span style="white-space: nowrap;"><!--
==Overview==
This template uses {{tl|nobr}} to make sure that no line breaks occur in the middle of a [[coordinates]] string. It also puts the numbers in parentheses and separates them with commas.


==Examples==
-->({{formatnum:{{{x|{{{1|{{#explode:{{#show:{{{page|{{PAGENAME}}}}}|?Has coordinates.Has x coordinate}}||{{#expr:{{{n|1}}}-1}}}}}}}}}}|R}}, <!--
;<nowiki>{{coords|10.0|20.0|30.0}}</nowiki>
-->{{formatnum:{{{y|{{{2|{{#explode:{{#show:{{{page|{{PAGENAME}}}}}|?Has coordinates.Has y coordinate}}||{{#expr:{{{n|1}}}-1}}}}}}}}}}|R}}, <!--
:{{coords|10.0|20.0|30.0}}
-->{{formatnum:{{{z|{{{3|{{#explode:{{#show:{{{page|{{PAGENAME}}}}}|?Has coordinates.Has z coordinate}}||{{#expr:{{{n|1}}}-1}}}}}}}}}}|R}})<!--


;<nowiki>{{coords|x=10.0|y=20.0|z=30.0}}</nowiki>
--><span class="noprint" style="margin-left: 0.25em;"><copylink text="/thumbtack
:{{coords|x=10.0|y=20.0|z=30.0}}
{{formatnum:{{{x|{{{1|{{#explode:{{#show:{{{page|{{PAGENAME}}}}}|?Has coordinates.Has x coordinate}}||{{#expr:{{{n|1}}}-1}}}}}}}}}}|R}}
 
{{formatnum:{{{y|{{{2|{{#explode:{{#show:{{{page|{{PAGENAME}}}}}|?Has coordinates.Has y coordinate}}||{{#expr:{{{n|1}}}-1}}}}}}}}}}|R}}
[[Category:Standardized Text Templates]]</noinclude>
{{formatnum:{{{z|{{{3|{{#explode:{{#show:{{{page|{{PAGENAME}}}}}|?Has coordinates.Has z coordinate}}||{{#expr:{{{n|1}}}-1}}}}}}}}}}|R}}">[Copy]</copylink></span> </span></includeonly><noinclude>
{{documentation}}</noinclude>

Latest revision as of 04:32, 4 June 2022

[edit] [purge] Documentation

Usage

This template uses {{nobr}} to make sure that no line breaks occur in the middle of a coordinates string. It also puts the numbers in parentheses and separates them with commas.

If no numbers are provided, the numbers come from the "Has coordinates" property of the same page, or the page given as the "page" parameter. If multiple sets of coordinates exist, the "n" parameter (default 1) selects which set to display, with the first set numbered 1.

Examples

{{coords|10.0|20.0|30.0}}
(10.0, 20.0, 30.0)[Copy]
{{coords|x=10.0|y=20.0|z=30.0}}
(10.0, 20.0, 30.0)[Copy]
{{coords}}
output based on "Has coordinates" properties defined on the page
{{coords|page=Top Dog Badge}}
(131.0, 319.7, -319.5)[Copy]
{{coords|page=Rail Rider Badge}}{{coords|page=Rail Rider Badge|n=2}}{{coords|page=Rail Rider Badge|n=3}}
(-4551.0, -187.6, 469.5)[Copy] (-2384.0, -238.6, 755.5)[Copy] (2226.0, -213.1, 1111.0)[Copy]