Difference between revisions of "Template:JKR/doc"

From blackwiki
Jump to navigation Jump to search
imported>WOSlinker
(add {{documentation subpage}})
imported>Johnuniq
(optional second parameter: svg, png, text)
Line 3: Line 3:
  
 
=== Examples ===
 
=== Examples ===
*<code><nowiki>{{JKR|1}}</nowiki></code> = {{JKR|1}}
+
*<code><nowiki>{{JKR|1}}</nowiki></code> {{JKR|1}}
*<code><nowiki>{{JKR|9999}}</nowiki></code> = {{JKR|9999}}
+
*<code><nowiki>{{JKR|9999}}</nowiki></code> {{JKR|9999}}
*<code><nowiki>{{JKR|P1}}</nowiki></code> = {{JKR|P1}}
+
*<code><nowiki>{{JKR|P1}}</nowiki></code> {{JKR|P1}}
*<code><nowiki>{{JKR|E40}}</nowiki></code> = {{JKR|E40}}
+
*<code><nowiki>{{JKR|E40}}</nowiki></code> → {{JKR|E40}}
 +
 
 +
=== Specifying output ===
 +
Some pages ([[List of Federal Roads in Malaysia|example]]) use this template many times. To avoid errors due to the large number of expensive function calls to test which images exist, an optional second parameter can be added:
 +
*<code>svg</code> to use the svg image
 +
*<code>png</code> to use the png image
 +
*<code>text</code> to use italic text
 +
 
 +
Examples:
 +
*<code><nowiki>{{JKR|1|svg}}</nowiki></code> → {{JKR|1|svg}}
 +
*<code><nowiki>{{JKR|1|png}}</nowiki></code> → {{JKR|1|png}}
 +
*<code><nowiki>{{JKR|1|text}}</nowiki></code> → {{JKR|1|text}}
  
 
<includeonly>
 
<includeonly>
 
[[Category:Malaysia expressway and road infobox templates]]
 
[[Category:Malaysia expressway and road infobox templates]]
 
</includeonly>
 
</includeonly>

Revision as of 00:57, 3 February 2019

This template displays the route marker for Malaysian roads given the route number. If the proper image does not exist on this wiki or Wikimedia Commons, the template will display the route number in italics until the image is uploaded. This template does not currently work for expressway routes and will display an error instead.

Examples

  • {{JKR|1}}Jkr-ft1.png
  • {{JKR|9999}}9999
  • {{JKR|P1}}P1
  • {{JKR|E40}}Wrong template: use {{MES-E|route number without "E"}}

Specifying output

Some pages (example) use this template many times. To avoid errors due to the large number of expensive function calls to test which images exist, an optional second parameter can be added:

  • svg to use the svg image
  • png to use the png image
  • text to use italic text

Examples:

  • {{JKR|1|svg}}Jkr-ft1.svg
  • {{JKR|1|png}}Jkr-ft1.png
  • {{JKR|1|text}}1