Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Param value/doc: Difference between revisions

Template page
No edit summary
No edit summary
Line 3: Line 3:
{{High-use}}
{{High-use}}
{{tlr|clear=right|pvalue|pval}}
{{tlr|clear=right|pvalue|pval}}
Provides a lightly bordered box to highlight param values on [[Wikipedia:Template documentation|Template documentation]] pages. Especially useful in cases where values may have leading or trailing blanks, or multiple embedded blanks.
Provides a lightly bordered box to highlight param values on Template documentation pages. Especially useful in cases where values may have leading or trailing blanks, or multiple embedded blanks.


== Usage ==
== Usage ==
Line 16: Line 16:
: {{para|border}}{{snd}}may be used to set border attributes. default: {{param value|thin solid #caa|bg=#f5fcf9}}. Alias: {{para|b}}.
: {{para|border}}{{snd}}may be used to set border attributes. default: {{param value|thin solid #caa|bg=#f5fcf9}}. Alias: {{para|b}}.
: {{para|bg-color}}{{snd}}may be used to set background-color. default: {{param value|white|bg=#f5fcf9}}. Alias: {{para|bg}}.
: {{para|bg-color}}{{snd}}may be used to set background-color. default: {{param value|white|bg=#f5fcf9}}. Alias: {{para|bg}}.
: {{para|style}}{{snd}} may be used to set any [[CSS|CSS style attributes]], with one or more semicolon-separated {{pval|''attribute'':value||bg=#f5fcf9|style=border-radius:3px}} pairs. default:none.
: {{para|style}}{{snd}} may be used to set any CSS style attributes, with one or more semicolon-separated {{pval|''attribute'':value||bg=#f5fcf9|style=border-radius:3px}} pairs. default:none.
: {{para|space}}{{snd}} may be used to make spaces visible. Alias: {{para|sp}}. See [[#Making spaces visible]] below.
: {{para|space}}{{snd}} may be used to make spaces visible. Alias: {{para|sp}}. See #Making spaces visible below.


'''Note on special characters:''' if the value to be highlighted contains an equal sign, it must be escaped: use <code><nowiki>{{=}}</nowiki></code> instead of a bare equal sign character.
'''Note on special characters:''' if the value to be highlighted contains an equal sign, it must be escaped: use <code><nowiki>{{=}}</nowiki></code> instead of a bare equal sign character.
Line 33: Line 33:
== Making spaces visible ==
== Making spaces visible ==


You may make [[Whitespace character|space characters]] visible by replacing them with any character you choose using param {{para|space}}. Here are some characters that have been historically used for this purpose. In these examples, there are two spaces between ''one'' and ''two'':
You may make space characters visible by replacing them with any character you choose using param {{para|space}}. Here are some characters that have been historically used for this purpose. In these examples, there are two spaces between ''one'' and ''two'':
* Space symbol{{snd}}([[Control Pictures#Block|U+2420]] = ␠ ) : <code><nowiki>{{param value|one  two|space=␠}}</nowiki></code> ⟶ {{param value|one  two|space=␠}}
* Space symbol{{snd}}(U+2420 = ␠ ) : <code><nowiki>{{param value|one  two|space=␠}}</nowiki></code> ⟶ {{param value|one  two|space=␠}}
* [[Blank symbol]]{{snd}}([[Control Pictures#Block|U+2422]] = ␢ ) : <code><nowiki>{{pvalue|one  two|space=␢}}</nowiki></code> ⟶ {{pvalue|one  two|space=␢}}
* Blank symbol{{snd}}(U+2422 = ␢ ) : <code><nowiki>{{pvalue|one  two|space=␢}}</nowiki></code> ⟶ {{pvalue|one  two|space=␢}}
** [[Blank symbol]]{{snd}} (smaller:  <small>␢</small>) : <code><nowiki>{{pvalue|one  two|space=<small>␢</small>}}</nowiki></code> ⟶ {{param value|one  two|space=<small>␢</small>}}
** Blank symbol{{snd}} (smaller:  <small>␢</small>) : <code><nowiki>{{pvalue|one  two|space=<small>␢</small>}}</nowiki></code> ⟶ {{param value|one  two|space=<small>␢</small>}}
* [[Middot]]{{snd}}([[Whitespace character#U+00B7|U+00B7]] = &middot; ) : <code><nowiki>{{pval|one  two|space=·}}</nowiki></code> ⟶ {{pval|one  two|space=·}}
* Middot{{snd}}(U+00B7 = &middot; ) : <code><nowiki>{{pval|one  two|space=·}}</nowiki></code> ⟶ {{pval|one  two|space=·}}
* Underbracket{{snd}}([[Miscellaneous Technical#(2380–23BF)|U+23B5]] = ⎵ ) :  <code><nowiki>{{pval|one  two|space=⎵}}</nowiki></code> ⟶ {{pval|one  two|space=⎵}}
* Underbracket{{snd}}(U+23B5 = ⎵ ) :  <code><nowiki>{{pval|one  two|space=⎵}}</nowiki></code> ⟶ {{pval|one  two|space=⎵}}
* White rectangle{{snd}}([[Geometric Shapes (Unicode block)#U+25A0–U+25CF|U+25AF]] = ▯ ) : <code><nowiki>{{pval|one  two|space=▯}}</nowiki></code> ⟶ {{pval|one  two|space=▯}}
* White rectangle{{snd}}(U+25AF = ▯ ) : <code><nowiki>{{pval|one  two|space=▯}}</nowiki></code> ⟶ {{pval|one  two|space=▯}}
* [[Undertie]]{{snd}}([[General Punctuation#Block|U+203F]] = ‿ ) : <code><nowiki>{{pval|one  two|space=‿}}</nowiki></code> ⟶ {{pval|one  two|space=‿}}
* Undertie{{snd}}(U+203F = ‿ ) : <code><nowiki>{{pval|one  two|space=‿}}</nowiki></code> ⟶ {{pval|one  two|space=‿}}


== See also ==
== See also ==

Revision as of 18:52, 6 April 2025

This page uses Creative Commons Licensed content from Wikipedia (view authors).

Template:High-use Template:Tlr Provides a lightly bordered box to highlight param values on Template documentation pages. Especially useful in cases where values may have leading or trailing blanks, or multiple embedded blanks.

Usage

{{param value|value}}

Parameters

There is one required positional parameter for the value, and four optional params: three for styling the display, and one replacement parameter for dealing with how to render a blank space:

|1= – the value to be highlighted; required (no default)
|border= – may be used to set border attributes. default: thin solid #caa. Alias: |b=.
|bg-color= – may be used to set background-color. default: white. Alias: |bg=.
|style= – may be used to set any CSS style attributes, with one or more semicolon-separated attribute:value pairs. default:none.
|space= – may be used to make spaces visible. Alias: |sp=. See #Making spaces visible below.

Note on special characters: if the value to be highlighted contains an equal sign, it must be escaped: use {{=}} instead of a bare equal sign character.

Examples

  • {{param value|2blanks between}} yields: 2blanks  between
  • {{param value|2blanks between|space=·}} yields: 2blanks··between
  • {{param value| * : # }} yields:   * : # 
  • {{param value| * : # |border=2px dashed khaki}} yields:   * : # 
  • {{param value|white|bg=yellow}} yields: white
  • {{pvalue|thin solid #caa|bg=#f5fcf9}} yields: Template:Pvalue
  • {{pval|* #|border=thin dashed purple|bg=#ffe6e6|style=border-radius:5px|space=␠}} yields: *␠␠#

Making spaces visible

You may make space characters visible by replacing them with any character you choose using param |space=. Here are some characters that have been historically used for this purpose. In these examples, there are two spaces between one and two:

  • Space symbol – (U+2420 = ␠ ) : {{param value|one two|space=␠}} ⟶ one␠␠two
  • Blank symbol – (U+2422 = ␢ ) : {{pvalue|one two|space=␢}} ⟶ Template:Pvalue
    • Blank symbol – (smaller: ␢) : {{pvalue|one two|space=<small>␢</small>}} ⟶ one␢␢two
  • Middot – (U+00B7 = · ) : {{pval|one two|space=·}} ⟶ one··two
  • Underbracket – (U+23B5 = ⎵ ) : {{pval|one two|space=⎵}} ⟶ one⎵⎵two
  • White rectangle – (U+25AF = ▯ ) : {{pval|one two|space=▯}} ⟶ one▯▯two
  • Undertie – (U+203F = ‿ ) : {{pval|one two|space=‿}} ⟶ one‿‿two

See also

  • {{mono}}, monospaced font only
  • {{code}}, which only provides syntax higlighting, without forbidding line breaks
  • {{Codett}}, wrapper for this template that removes background and border styling
  • {{PreCode}}, which forbids line breaks inside the code
  • {{Syntaxhighlight}}
  • {{kbd}}, for keyboard input

Template:Semantic markup templates