Template:Navbar: Difference between revisions

From LPFM Wiki
Jump to navigation Jump to search
Mediawiki>Shirayuki
m (new tvar syntax)
(No difference)

Revision as of 23:57, 12 February 2022


{{#if:||{{#if:|{{{text}}}|This box:}} }}{{#if:|[}}[[{{#switch:

|#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:|]}}

Template documentation

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:

{{#if:||{{#if:|{{{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:|]}}

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

Optional parameters

Options Parameters Produces...
Basic {{Template:Navbar}} {{#if: {{{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}} {{#if: 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}} {{#if:1 {{{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}} {{#if:1 {{{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}} {{#if: {{{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}} {{#if: {{{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}} {{#if:1 {{{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> |=

{{#if:{{safesubst:#switch: 1
|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}}}}|{{#if:1||{{#if:|{{{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|]}}}}}} {{#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|sandbox||{{#if:{{#ifexpr: (

{{#ifeq:navbar|doc|1|0}} or ( {{#ifeq:{{#titleparts:template:navbar|-1|-2}}|doc|1|0}} and {{#if:|1|0}} ) )|1|}}||}}}} | #default=

 {{#switch:

|=

{{#if:{{safesubst:#switch: 1
|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}}}}|{{#if:1||{{#if:|{{{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|]}}}}}} {{#if:||This is the TemplateData documentation for this template used by VisualEditor and other tools.}}

Navbar

{{#ifeq:Navbar|sandbox||{{#if:{{#ifexpr: (

{{#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

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Template name1

The template for which to create navbar links

Auto value
{{subst:PAGENAME}}
Templaterequired
Texttext

Custom leading text

Default
This box:
Lineoptional
Mini?mini

Only emit “v · d · e”

Booleanoptional
Plain?plain

Omit leading text

Default
{{{mini}}}
Booleanoptional
Brackets?brackets

Surround links with brackets

Booleanoptional
No Editnoedit

Omit the “Edit” link

Booleanoptional
Stylestyle

The CSS style attribute

Stringoptional
Font Stylefontstyle

The CSS style attribute for text

Stringoptional

{{#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.