Template:Navbar: Difference between revisions
Mediawiki>Shirayuki m (new tvar syntax) |
m (1 revision imported) |
(No difference)
|
Latest revision as of 12:56, 28 July 2022
|#default = | = {{#ifeq: | | Template:{{{1}}} | }}
}}|{{#if:|v|view}}]] · [{{fullurl:{{TALKPAGENAME:{{#switch:
|#default = | = {{#ifeq: | | Template:{{{1}}} | }}
}}}}}} {{#if:|d|talk}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = | = {{#ifeq: | | Template:{{{1}}} | }}
}}|action=edit}} {{#if:|e|edit}}]}}{{#if:|]}}
This template uses TemplateStyles: |
Usage
General
When one of the following examples is placed inside a given template, it adds navbar navigational functionality:
{{Template:Navbar}}
{{Template:Navbar}}
{{Template:Navbar}}
The {{subst:PAGENAME}}
will be substituted with the template's name when parsed by the servers.
For example, {{Template:Navbar}}
gives:
|#default = Navbar/doc | = {{#ifeq: | | Template:navbar/doc | Navbar/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = Navbar/doc | = {{#ifeq: | | Template:navbar/doc | Navbar/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:|]}}
Font-size
Font-size is 88%
when used in a navbar, and 100%
when nested in a navbox.
In the navbar, the weight is "normal
"; when nested in navbox, it takes on the outer setting.
The middot is bold.
Examples
Required parameters
{{Template:Navbar}}
— the template name is required.
Optional parameters
Options | Parameters | Produces... | |||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Basic | {{Template:Navbar}}
|
{{{text}}}|<translate> This box:</translate>}} }}{{#if:|[}}[[{{#switch: | #default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch: |
#default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:|]}} | |
Different text | {{Template:Navbar}}
|
This template:|<translate> This box:</translate>}} }}{{#if:|[}}[[{{#switch: | #default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch: |
#default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:|]}} | |
Without "This box:" text | {{Template:Navbar}}
|
{{{text}}}|<translate> This box:</translate>}} }}{{#if:|[}}[[{{#switch: | #default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch: |
#default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:|]}} | |
Short version | {{Template:Navbar}}
|
{{{text}}}|<translate> This box:</translate>}} }}{{#if:|[}}[[{{#switch: | #default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:1|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:1|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch: |
#default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:1|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:|]}} | |
With a color option | {{Template:Navbar}}
|
{{{text}}}|<translate> This box:</translate>}} }}{{#if:|[}}[[{{#switch: | #default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|<span style="color:green" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="color:green" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch: |
#default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|action=edit}} <span style="color:green" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:|]}} | |
With brackets | {{Template:Navbar}}
|
{{{text}}}|<translate> This box:</translate>}} }}{{#if:1|[}}[[{{#switch: | #default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch: |
#default = Navbar/doc | =
{{#ifeq: | |
Template:navbar/doc | Navbar/doc
}} }}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}} | |
Custom namespace | {{Template:Navbar}}
|
{{{text}}}|<translate> This box:</translate>}} }}{{#if:1|[}}[[{{#switch: User | #default = User:Example | =
{{#ifeq: User | |
Template:User:Example | Example
}} }}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch: User |
#default = User:Example | =
{{#ifeq: User | |
Template:User:Example | Example
}} }}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}} |
TemplateData
{{#ifeq:navbar |doc
|
{{#ifeq:show |show
| Template:Mbox }}{{#if: | | {{#ifexist:Template:Navbar | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]] | }} }} | }}
{{#switch:<translate></translate> |=
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:Navbar/doc|{{#ifeq:Template:Navbar|{{#switch:
|#default = Navbar/doc | = {{#ifeq: | | Template:Navbar/doc | Navbar/doc }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:navbar|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:navbar|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = Navbar/doc | = {{#ifeq: | | Template:Navbar/doc | Navbar/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = Navbar/doc | = {{#ifeq: | | Template:Navbar/doc | Navbar/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||<translate> This is the [[<tvar name=1>Special:MyLanguage/Help:TemplateData</tvar>|TemplateData]] documentation for this template used by [[<tvar name=2>Special:MyLanguage/VisualEditor</tvar>|VisualEditor]] and other tools.</translate>}}
Navbar
{{#ifeq:navbar|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:navbar|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=
{{#switch:
|=
|no |n |false |0 = | = |¬ = |yes |y |true |1 = yes |#default = yes
}}|{{#ifexpr:{{#if:Navbar/doc|{{#ifeq:Template:Navbar|{{#switch:
|#default = Navbar/doc | = {{#ifeq: | | Template:Navbar/doc | Navbar/doc }}
}}|0|1}}|not{{#ifexpr: ( {{#ifeq:navbar|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:navbar|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|0}}}}|
|#default = Navbar/doc | = {{#ifeq: | | Template:Navbar/doc | Navbar/doc }}
}}|<span style="" title="<translate nowrap> View this template</translate>">{{#if:|<translate> v</translate>|<translate> view</translate>}}]] · [[[:Template:Fullurl:]] <span style="" title="<translate nowrap> Discuss this template</translate>">{{#if:|<translate> d</translate>|<translate> talk</translate>}}]{{#if:|| · [{{fullurl:{{#switch:
|#default = Navbar/doc | = {{#ifeq: | | Template:Navbar/doc | Navbar/doc }}
}}|action=edit}} <span style="" title="<translate nowrap> Edit this template</translate>">{{#if:|<translate> e</translate>|<translate> edit</translate>}}]}}{{#if:1|]}}}}}} {{#if:||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}
Navbar
{{#ifeq:navbar|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:navbar|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=
Lua error: expandTemplate: template loop detected.
}} }}
Adds edit links to navboxes and other templates
Parameter | Description | Type | Status | |
---|---|---|---|---|
Template name | 1 | The template for which to create navbar links
| Template | required |
Text | text | Custom leading text
| Line | optional |
Mini? | mini | Only emit “v · d · e” | Boolean | optional |
Plain? | plain | Omit leading text
| Boolean | optional |
Brackets? | brackets | Surround links with brackets | Boolean | optional |
No Edit | noedit | Omit the “Edit” link | Boolean | optional |
Style | style | The CSS style attribute | String | optional |
Font Style | fontstyle | The CSS style attribute for text | String | optional |
{{#if:{{#ifeq:Navbar|sandbox|1}}{{#ifeq:Navbar|doc|1}}|| }}
Notes
Navbar is contained within a {{#if:|
|
}}{{#switch:pair
|c|close =
|s|single
|o|open
|p|pair = <div{{#if:| {{{params}}}}}
}}{{#switch:pair
|c|close =
|s|single = />
|o|open = >
|p|pair = >...
}}{{#switch:pair
|s|single
|o|open =
|c|close
|p|pair = </div>
}}{{#if:|
|
}} in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a {{#if:|
|
}}{{#switch:pair
|c|close =
|s|single
|o|open
|p|pair = <span{{#if:| {{{params}}}}}
}}{{#switch:pair
|c|close =
|s|single = />
|o|open = >
|p|pair = >...
}}{{#switch:pair
|s|single
|o|open =
|c|close
|p|pair = </span>
}}{{#if:|
|
}} or other inline element, because Tidy will 'fix' situations where it finds block elements inside inline elements.