Jump to content

Template:H: Difference between revisions

From pool
[unchecked revision][unchecked revision]
Content deleted Content added
No edit summary
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{Highlight|{{{1}}}}}</includeonly><noinclude>
<includeonly>{{#if: {{{3|}}} | {{Highlight|{{{1}}}|{{{2|yellow}}}|{{{3}}}}} | {{Highlight|{{{1}}}|{{{2|yellow}}}}} }}</includeonly><noinclude>

For adding yellow highlight to specified text. The highlight color can be changed, and the highlight can also be set to expire at a certain date. Please keep template usage to talk pages only.

=== Usage ===

<code><nowiki>{{highlight | text | color (optional) | expiration (optional) }}</nowiki></code>

'''Parameters'''
*'''text''' (parameter 1): Enter the text to be highlighted.

'''Optional parameters'''

These parameters are optional, but unused parameters must be separated by a pipe (see examples below):

*'''color''' (parameter 2): Colors may be specified by word (e.g., "red", "blue", "lightgreen") or in hexadecimal format (e.g., "#FF0066", "#C0C0C0"). If no value is given for the color, the template defaults to yellow.

*'''expiration''' (parameter 3): Highlights may be set to expire on a certain date, which leaves the text as-is, but removes the highlight color. The expiration value can be specified in any format.

===Examples===
{| class="wikitable"
|-
! code !! output !! notes
|-
| <nowiki>{{h | text }}</nowiki> || {{h | text }} || The default highlight color is yellow
|-
| <nowiki>{{h | text | lightblue }}</nowiki> || {{h | text | lightblue }} || The second parameter is the highlight color
|-
| <nowiki>{{h | text | pink | 2011-01-01 }}</nowiki> || {{h | text | pink | 2011-01-01 }} || This is not highlighted since 1 January 2011 is in the past
|-
| <nowiki>{{h | text | pink |</nowiki> {{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}} <nowiki>}}</nowiki> || {{h | text || {{CURRENTYEAR}}-{{CURRENTMONTH}}-{{CURRENTDAY2}}}} || There is no highlighting on the expiration date purge this page's server cache if today's date is not shown)
|-
| <nowiki>{{h | text | #00FF00 | 1 January 2099 }}</nowiki> || {{h | text | #00FF00 | 1 January 2099 }} || This is highlighted since 1 January 2099 is in the future
|-
| <nowiki>{{h | text || January 1, 2099 }}</nowiki> || {{h | text || January 1, 2099 }} || Note the color parameter, left blank, is still represented<br> with a pipe (followed by the expiration parameter pipe)
|}

<templatedata>
{
"params": {
"1": {
"label": "Text to be highlighted",
"example": "Highlight this text",
"type": "string"
},
"2": {
"label": "Optional Colour",
"example": "lightblue or #ff8c00",
"type": "string"
},
"3": {
"label": "Expiration Date",
"example": "1 January 2099",
"type": "string"
}
},
"description": "Escalation Notice"
}
</templatedata>

[[Category:AutoDumpContentFromCommons]]
[[Category:AutoDumpContentFromCommons]]
== Usage ==
Highlight a piece of text:
<pre>
Highlight some {{H|Random}} word in the middle of a sentence
</pre>
Looks like this:<br>
Highlight some {{H|Random}} word in the middle of a sentence
</noinclude>
</noinclude>

Latest revision as of 18:45, 3 March 2020


For adding yellow highlight to specified text. The highlight color can be changed, and the highlight can also be set to expire at a certain date. Please keep template usage to talk pages only.

Usage

{{highlight | text | color (optional) | expiration (optional) }}

Parameters

  • text (parameter 1): Enter the text to be highlighted.

Optional parameters

These parameters are optional, but unused parameters must be separated by a pipe (see examples below):

  • color (parameter 2): Colors may be specified by word (e.g., "red", "blue", "lightgreen") or in hexadecimal format (e.g., "#FF0066", "#C0C0C0"). If no value is given for the color, the template defaults to yellow.
  • expiration (parameter 3): Highlights may be set to expire on a certain date, which leaves the text as-is, but removes the highlight color. The expiration value can be specified in any format.

Examples

code output notes
{{h | text }} text The default highlight color is yellow
{{h | text | lightblue }} text The second parameter is the highlight color
{{h | text | pink | 2011-01-01 }} text This is not highlighted since 1 January 2011 is in the past
{{h | text | pink | 2026-04-07 }} text There is no highlighting on the expiration date purge this page's server cache if today's date is not shown)
{{h | text | #00FF00 | 1 January 2099 }} text This is highlighted since 1 January 2099 is in the future
{{h | text || January 1, 2099 }} text Note the color parameter, left blank, is still represented
with a pipe (followed by the expiration parameter pipe)

Escalation Notice

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
Text to be highlighted1

no description

Example
Highlight this text
Stringoptional
Optional Colour2

no description

Example
lightblue or #ff8c00
Stringoptional
Expiration Date3

no description

Example
1 January 2099
Stringoptional