Difference between revisions of "Template:IPaddr/doc"

From blackwiki
Jump to navigation Jump to search
imported>Dandorid
imported>Dandorid
(→‎Examples: slash=no)
Line 19: Line 19:
 
<code><nowiki>{{IPaddr|203.0.113.109|29|netmask=dotted}}</nowiki></code> yields: {{IPaddr|203.0.113.109|29|netmask=dotted}}, which might sometimes be useful.
 
<code><nowiki>{{IPaddr|203.0.113.109|29|netmask=dotted}}</nowiki></code> yields: {{IPaddr|203.0.113.109|29|netmask=dotted}}, which might sometimes be useful.
  
<code><nowiki>{{IPaddr||18|netmask=dotted}}</nowiki></code> yields just the netmask in [[dotted decimal]] notation: {{IPaddr||18|netmask=dotted}}.
+
<code><nowiki>{{IPaddr||18|netmask=dotted|slash=no}}</nowiki></code> yields just the netmask in [[dotted decimal]] notation: {{IPaddr||18|netmask=dotted|slash=no}} (without the slash).
  
 
<code><nowiki>{{IPaddr|2001:db8:27df:34::|64}}</nowiki></code> yields: {{IPaddr|2001:db8:27df:34::|64}}.
 
<code><nowiki>{{IPaddr|2001:db8:27df:34::|64}}</nowiki></code> yields: {{IPaddr|2001:db8:27df:34::|64}}.

Revision as of 09:24, 3 May 2018

Introduction

Template {{IPaddr}} is used to make an IP address stand out in the text, to improve readability.

Arguments

The first parameter is the IP address to be displayed. The second parameter is optional and indicates the number of bits in the network address in CIDR notation. If given, it is appended to the first with a slash (/) as a separator. When the option netmask=dotted is set, the second argument (if present) is translated to a dotted decimal netmask.

Examples

{{IPaddr|198.51.100.227}} yields: 198.51.100.227.

{{IPaddr|203.0.113.109/29}} adds the network mask as is: 203.0.113.109/29, but

{{IPaddr|203.0.113.109|29}} yields: 203.0.113.109/29 which adds some non-breaking space around the slash ('/') separator, to improve readability.

{{IPaddr||29}} yields just the netmask: /29.

{{IPaddr|203.0.113.109|29|netmask=dotted}} yields: 203.0.113.109/255.255.255.248, which might sometimes be useful.

{{IPaddr||18|netmask=dotted|slash=no}} yields just the netmask in dotted decimal notation: 255.255.192.0 (without the slash).

{{IPaddr|2001:db8:27df:34::|64}} yields: 2001:db8:27df:34::/64.