Template:NW2: Difference between revisions
More actions
m replacing deprecated template redirect |
Fix Linter errors. |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
<span style="white-space:nowrap">{{#switch:{{{2}}} | <onlyinclude><span style="white-space:nowrap">{{#switch:{{{2}}} | ||
|c|tt={{#ifeq:{{{2}}}|c|<code>|< | |c|tt={{#ifeq:{{{2}}}|c|<code>|<span style="font-family: monospace, monospace;">}}{{#tag:nowiki|{{{3}}}}}{{#ifeq:{{{2}}}|c|</code>|</span>}} | ||
|nw={{#ifeq:{{{1}}}|c|<code>|< | |nw={{#ifeq:{{{1}}}|c|<code>|<span style="font-family: monospace, monospace;">}}{{#tag:nowiki|{{{3}}}}}{{#ifeq:{{{1}}}|c|</code>|</span>}} | ||
|{{#switch:{{{1}}} | |{{#switch:{{{1}}} | ||
|c=<code>{{{2}}}</code> | |c=<code>{{{2}}}</code> | ||
|tt=< | |tt=<span style="font-family: monospace, monospace;">{{{2}}}</span> | ||
|nw={{#tag:nowiki|{{{2}}}}} | |nw={{#tag:nowiki|{{{2}}}}} | ||
|{{{1}}} | |{{{1}}} | ||
}} | }} | ||
}}</span>< | }}</span></onlyinclude> | ||
{{Documentation}} | |||
<!-- Add categories to the /doc subpage and interwikis in Wikidata, not here! --> | |||
Latest revision as of 17:50, 3 November 2022
{{{1}}}
Prevents wrapping of lines like {{nowrap}} (redirect: {{NW}}) plus the option to also apply <tt>/<code> tags or <nowiki> tags or both. This also works without any of those but if all you want is the no wrapping part use {{nowrap}} instead.
Note: The nowiki option makes use of {{#tag:}}, which doesn't work correctly with templates.
Usage
{{NW2 |1= |2= |3= }}
The order doesn't matter as long as the text goes last (e.g. {{NW2|c|nw|text}} is the same as {{NW2|nw|c|text}}).
- {{NW2|c|text}} - nowrap +
<code>text
- {{NW2|tt|text}} - nowrap +
<tt>- text
- {{NW2|nw|text}} - nowrap +
<nowiki>- ''text''
- {{NW2|c|nw|text}} - nowrap +
<code>+<nowiki>''text''
- {{NW2|nw|tt|text}} - nowrap +
<tt>+<nowiki>- ''text''
Edge cases:
Template parameters
| Parameter | Description | Default | Status | |
|---|---|---|---|---|
1 | Option 1 | The first option | empty | suggested |
2 | Option 2 | The second option | empty | optional |
3 | Text | The text content | empty | required |
Additional information
The template is intended to be used in the following namespaces: all namespaces
The template is intended to be used by the following user groups: all users
Relies on:
See also
Localization
This template is not intended to be localized.