Revision as of 16:33, 31 August 2006 editNetscott (talk | contribs)Extended confirmed users22,834 edits rm cs interwiki, template deleted there← Previous edit | Latest revision as of 09:40, 30 November 2024 edit undo172.97.141.219 (talk) →Font size and weight: the | ||
(326 intermediate revisions by more than 100 users not shown) | |||
Line 1: | Line 1: | ||
{{documentation subpage}} | |||
<includeonly>:''This template documentation is ] from ]'' </span>]</includeonly> | |||
{{#ifeq:{{BASEPAGENAME}}|Navbar|{{used in system}}}} | |||
<!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE --> | |||
{{lua|Module:Navbar}}{{#ifeq:{{BASEPAGENAME}}|VTE|{{tsh|V}}}} | |||
{{esoteric}} | |||
{{tlx|Navbar}} provides a small "view '''·''' talk '''·''' edit" navigation bar. It is primarily used for content-heavy templates and other transcluded content blocks, so that the content inside the template or block is more easily editable {{lang|la|in situ}} where it was found, without having track it down through examining transclusion code. {{tnull|Navbar}}'s extremely high use rate and consequent protection level are because it is integrated as a feature into numerous ] and ] templates used in millions of articles. It is also a regular feature of many internal-use templates and tables of the Misplaced Pages, Help, and Template ]. | |||
==Usage== | ==Usage== | ||
===General=== | |||
Copyable empty example: | |||
When one of the following examples is placed inside a given ] (or block of content used for ]), it adds basic navbar navigational functionality: | |||
:<syntaxhighlight lang="wikitext" inline>{{navbar|{{subst:PAGENAME}}|mini=y}}</syntaxhighlight> | |||
:<syntaxhighlight lang="wikitext" inline>{{navbar|{{subst:PAGENAME}}|plain=y}}</syntaxhighlight> | |||
:<syntaxhighlight lang="wikitext" inline>{{navbar|{{subst:PAGENAME}}|fontstyle=color: green; font-style: italic;}}</syntaxhighlight> | |||
The <syntaxhighlight lang="wikitext" inline>{{subst:PAGENAME}}</syntaxhighlight> will be ] with the page name of the real location of the content when parsed by the servers. For example, <syntaxhighlight lang="wikitext" inline>{{navbar|Navbar/doc}}</syntaxhighlight> gives:<br />{{navbar|Navbar/doc}} | |||
<nowiki>{{Tnavbar|Tnavbar}}</nowiki> gives: {{Tnavbar|Tnavbar}} | |||
If the page is moved or renamed the substituted text will need to be updated accordingly. Alternatively, you can use <code>{{mfl|params|self}}</code> instead of <syntaxhighlight lang="wikitext" inline>{{subst:PAGENAME}}</syntaxhighlight> to keep track of the current location of the transcluded page: | |||
==Note to editors== | |||
This template is represented across ] please tread lightly when editing here. Conducting sufficient ] to establish the validity of edits relative to Tnavbar is '''strongly''' encouraged prior to attempting to integrate changes. | |||
: <syntaxhighlight lang="wikitext" inline>{{navbar|{{#invoke:params|self}}|mini=...|plain=...|...}}</syntaxhighlight> | |||
==Examples== | |||
<pre>{{Tnavbar|Name of Template|mini= |nodiv= |plain= }}</pre> | |||
When used in content that is selectively transcluded but which is also used as-is in its original location, this template should be wrapped in {{xtag|includeonly|p}} markup, so that it only appears when transcluded. | |||
=== Required parameters === | |||
*<code><nowiki>{{Tnavbar|Name of Template}}</nowiki></code> the template name is required. | |||
=== |
===Font size and weight === | ||
The font-size is 88% when used in a topical navbar template or in plain text, and 100% when nested in a navbox or infobox (because those templates' text size is already reduced; the "100%" is relative to the surrounding template's own content, not that of the entire page). The {{para|fontstyle}} parameter can be used to adjust the font size as needed (e.g. to reduce font size even more when the template is used inside a block element with a large font size). Do not abuse this to make excessively small text (i.e. less than 85% of the normal page text), since that causes ] for many readers. | |||
In a topical navbar, the weight is "normal"; when nested in a navbox or infobox, it inherits the style of the surrounding content. The middot bullets are bold for better visibility. | |||
=== Block level element === | |||
The template generates block-level markup with {{tag|div}} tags, and therefore, any surrounding markup cannot include {{tag|span}} tags, which would cause a ] lint error. | |||
==Examples== | |||
===Required parameters=== | |||
*<code><nowiki>{{navbar|Template Name}}</nowiki></code> – the template name is required. | |||
===Optional parameters=== | |||
{| class="wikitable" | {| class="wikitable" | ||
! |
! Options !! Parameters !! Produces... !! "Shortcut" template | ||
|- | |- | ||
| |
| Basic || <code><nowiki>{{navbar|Template Name}}</nowiki></code> || {{navbar|Navbar/doc}} || | ||
|- | |- | ||
| Different text || <code><nowiki>{{navbar|Template Name|</nowiki>'''text'''<nowiki>=This template:}}</nowiki></code> || {{navbar|Navbar/doc|text=This template:}} || | |||
|<nowiki>{{Tnavbar|Tnavbar|nodiv=1}}</nowiki> Good for "blending" into text. || → || {{Tnavbar|Tnavbar|nodiv=1}} Good for "blending" into text. | |||
|- | |- | ||
| Without "This box:" text || <code><nowiki>{{navbar|Template Name|</nowiki>'''plain'''<nowiki>=y}}</nowiki></code> || {{navbar|Navbar/doc|plain=y}} || {{tl|view}} | |||
|<nowiki>{{Tnavbar|Tnavbar|mini=1|nodiv=1}}</nowiki> Good for "blending" into text. || → || {{Tnavbar|Tnavbar|mini=1|nodiv=1}} Good for "blending" into text. | |||
|- | |- | ||
| Short version || <code><nowiki>{{navbar|Template Name|</nowiki>'''mini'''<nowiki>=y}}</nowiki></code> || {{navbar|Navbar/doc|mini=y}} || {{tl|v}} | |||
|<nowiki>No "This box:" text. {{Tnavbar|Tnavbar|plain=1}}</nowiki> || → ||No "This box:" text. {{Tnavbar|Tnavbar|plain=1}} | |||
|- | |- | ||
| With brackets || <code><nowiki>{{navbar|Template Name|</nowiki>'''brackets'''<nowiki>=y}}</nowiki></code> || {{navbar|Navbar/doc|brackets=y}} || | |||
|<nowiki>Blended no "This box:" text. {{Tnavbar|Tnavbar|plain=1|nodiv=1}}</nowiki> || → ||Blended no "This box:" text. {{Tnavbar|Tnavbar|plain=1|nodiv=1}} | |||
|- | |||
| With font styling examples (]) || <code><nowiki>{{navbar|Template Name|</nowiki>'''fontstyle'''<nowiki>=color: green; font-style: italic;}}</nowiki></code> || {{navbar|Navbar/doc|fontstyle=color: green; font-style: italic;}} || | |||
|- | |||
| With whole-template styling examples (]) || <code><nowiki>{{navbar|Template Name|</nowiki>'''style'''<nowiki>=float:right; background: Beige; padding: 5px; border: 1px solid;}}</nowiki></code> || {{navbar|Navbar/doc|style=float:right; background: Beige; padding: 5px; border: 1px solid;}} || | |||
|- | |||
| History, move, and watchlist links || <code><nowiki>{{navbar|template=Template Name|e|t|h|m|w}}</nowiki></code> || {{navbar|template=Navbar/doc|e|t|h|m|w}} | |||
|} | |} | ||
Note that to show the history, move, and watchlist links, {{para|template}} needs to be set to the template value specifically. Individual values can be left out of this list, e.g. <code><nowiki>{{navbar|template=Template Name|h|m|w}}</nowiki></code> will only show the view, history, move, and watchlist links. | |||
==See also== | |||
<big>'''Please note:''' The following see alsos refer to previous versions of Tnavbar that are now deprecated. Any templates utilizing the following versions of Tnavbar should be updated to use Tnavbar with Tnavbar's added parameter system. Please do not further employ the following templates when adding Tnavbar to given templates.</big> | |||
===Shortcut templates === | |||
The <code>mini=y</code> and <code>plain=y</code> parameters can be avoided by using the {{tlx|v}} or {{tlx|view}} templates, respectively, instead. | |||
{{tl|view}} and {{tl|v}} also support changing the shown links, for example only view and edit, or only view and talk: | |||
{| class="wikitable" | {| class="wikitable" | ||
! Template !! colspan=2 | This... !! colspan=2 | Produces... | |||
|- | |- | ||
! Code | |||
| '''This template''' || → || Divides into a separate section: <nowiki>{{Tnavbar|Tnavbar}}</nowiki> like so. || → || Divides into a separate section: {{Tnavbar|Tnavbar}} like so. | |||
! Result | |||
|- | |- | ||
|{{demo|br=<td>|<nowiki>{{view|template=view/doc}}</nowiki>}} | |||
| {{tl|Tnavbar-mini}} || → || Divides into a separate section: <nowiki>{{Tnavbar-mini|Tnavbar}}</nowiki> like so. || → || Divides into a separate section: {{Tnavbar-mini|Tnavbar}} like so. | |||
|- | |- | ||
|{{demo|br=<td>|<nowiki>{{view|template=view/doc|talk}}</nowiki>}} | |||
| {{tl|Tnavbar-plain}} || → || Divides into a separate section: <nowiki>{{Tnavbar-plain|Tnavbar}}</nowiki> like so. || → || Divides into a separate section: {{Tnavbar-plain|Tnavbar}} like so. | |||
|- | |- | ||
|{{demo|br=<td>|<nowiki>{{view|template=view/doc|talk|edit}}</nowiki>}} | |||
| {{tl|Tnavbar-nodiv}} || → || Good for "blending" into text. <nowiki>{{Tnavbar-nodiv|Tnavbar}}</nowiki> || → || Good for "blending" into text. {{Tnavbar-nodiv|Tnavbar}} | |||
|- | |- | ||
|{{demo|br=<td>|<nowiki>{{v|template=v/doc}}</nowiki>}} | |||
| {{tl|Tnavbar-mini-nodiv}} || → || Good for "blending" <nowiki>{{Tnavbar-mini-nodiv|Tnavbar}}</nowiki> into text. || → ||Good for "blending" {{Tnavbar-mini-nodiv|Tnavbar}} into text. | |||
|- | |- | ||
|{{demo|br=<td>|<nowiki>{{v|template=v/doc|t}}</nowiki>}} | |||
| {{tl|Tnavbar-plain-nodiv}} || → || <nowiki>{{Tnavbar-plain-nodiv|Tnavbar}}</nowiki> Good for "blending" into text. || → || {{Tnavbar-plain-nodiv|Tnavbar}} Good for "blending" into text. | |||
|- | |||
|{{demo|br=<td>|<nowiki>{{v|template=v/doc|t|e}}</nowiki>}} | |||
|} | |} | ||
==Notes== | |||
<includeonly> | |||
Navbar is contained within a {{tag|div}} in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a {{tag|span}} or other inline element, because the ] extension will 'fix' situations where it finds block elements inside inline elements. | |||
<!-- ADD CATEGORIES BELOW THIS LINE --> | |||
] | |||
==Prepackaged== | |||
;{{tl|Navbar-header}}: Positions {{navbar|Navbar/doc|mini=1}} on the right edge of the line, often used in non-collapsible navbox heading. | |||
;{{tl|Navbar-collapsible}}: For use in conjunction with ], floats {{navbar|Navbar/doc|mini=1}} opposite of the / feature. | |||
==See also== | |||
{{Edit templates}} | |||
Other ], including: | |||
*{{tl|Talk}} – plain talk link | |||
*{{tl|Watch}} – plain link that adds the page to your ] | |||
*] | |||
{{Navigation templates}} | |||
== TemplateData == | |||
{{TemplateData header}} | |||
<templatedata> | |||
{ | |||
"description": "When placed inside a given template, it adds navbar navigational functionality", | |||
"params": { | |||
"1": { | |||
"label": "Template Name", | |||
"description": "The name of the template, so links work correctly", | |||
"type": "string", | |||
"default": "", | |||
"required": true | |||
}, | |||
"text": { | |||
"label": "Different text", | |||
"description": "Allows custom text to replace the default 'this box'", | |||
"type": "string", | |||
"default": "This box", | |||
"required": false | |||
}, | |||
"plain": { | |||
"label": "Without 'This box:' text", | |||
"description": "Removes 'This box'", | |||
"type": "number", | |||
"default": "0", | |||
"required": false | |||
}, | |||
"mini": { | |||
"label": "Short Version", | |||
"description": "Shortens text to V T E", | |||
"type": "number", | |||
"default": "0", | |||
"required": false | |||
}, | |||
"brackets": { | |||
"label": "with brackets", | |||
"description": "adds brackets before and after the links", | |||
"type": "number", | |||
"default": "0", | |||
"required": false | |||
}, | |||
"fontstyle": { | |||
"label": "Font color", | |||
"description": "Allows you to change the color of the font (in the format color:green)", | |||
"type": "string", | |||
"default": "", | |||
"required": false | |||
}, | |||
"style": { | |||
"label": "To float to the side", | |||
"description": "Allows the template to float to the side (format=float:right)", | |||
"type": "string", | |||
"default": "float:left", | |||
"required": false | |||
} | |||
<!-- ADD INTERWIKIS BELOW THIS LINE --> | |||
} | |||
] | |||
} | |||
</includeonly> | |||
</templatedata><!--- | |||
PLEASE ADD METADATA TO THE <includeonly> SECTION HERE | |||
---><includeonly>{{Sandbox other|| | |||
] | |||
}}</includeonly> |
Latest revision as of 09:40, 30 November 2024
This is a documentation subpage for Template:Navbar. It may contain usage information, categories and other content that is not part of the original template page. |
This template is used in system messages, and on approximately 41,000 pages. Changes to it can cause immediate changes to the Misplaced Pages user interface. To avoid major disruption, any changes should be tested in the template's /sandbox or /testcases subpages, or in your own user subpage. The tested changes can be added to this page in a single edit. Please discuss changes on the talk page before implementing them. |
This template uses Lua: |
{{Navbar}}
provides a small "view · talk · edit" navigation bar. It is primarily used for content-heavy templates and other transcluded content blocks, so that the content inside the template or block is more easily editable in situ where it was found, without having track it down through examining transclusion code. {{Navbar}}
's extremely high use rate and consequent protection level are because it is integrated as a feature into numerous navigation box and infobox templates used in millions of articles. It is also a regular feature of many internal-use templates and tables of the Misplaced Pages, Help, and Template namespaces.
Usage
General
When one of the following examples is placed inside a given template (or block of content used for selective transclusion), it adds basic navbar navigational functionality:
{{navbar|{{subst:PAGENAME}}|mini=y}}
{{navbar|{{subst:PAGENAME}}|plain=y}}
{{navbar|{{subst:PAGENAME}}|fontstyle=color: green; font-style: italic;}}
The {{subst:PAGENAME}}
will be substituted with the page name of the real location of the content when parsed by the servers. For example, {{navbar|Navbar/doc}}
gives:
If the page is moved or renamed the substituted text will need to be updated accordingly. Alternatively, you can use {{#invoke:params|self}}
instead of {{subst:PAGENAME}}
to keep track of the current location of the transcluded page:
{{navbar|{{#invoke:params|self}}|mini=...|plain=...|...}}
When used in content that is selectively transcluded but which is also used as-is in its original location, this template should be wrapped in <includeonly>...</includeonly>
markup, so that it only appears when transcluded.
Font size and weight
The font-size is 88% when used in a topical navbar template or in plain text, and 100% when nested in a navbox or infobox (because those templates' text size is already reduced; the "100%" is relative to the surrounding template's own content, not that of the entire page). The |fontstyle=
parameter can be used to adjust the font size as needed (e.g. to reduce font size even more when the template is used inside a block element with a large font size). Do not abuse this to make excessively small text (i.e. less than 85% of the normal page text), since that causes accessibility problems for many readers.
In a topical navbar, the weight is "normal"; when nested in a navbox or infobox, it inherits the style of the surrounding content. The middot bullets are bold for better visibility.
Block level element
The template generates block-level markup with <div>...</div>
tags, and therefore, any surrounding markup cannot include <span>...</span>
tags, which would cause a div-span-flip lint error.
Examples
Required parameters
{{navbar|Template Name}}
– the template name is required.
Optional parameters
Options | Parameters | Produces... | "Shortcut" template |
---|---|---|---|
Basic | {{navbar|Template Name}} |
This box: | |
Different text | {{navbar|Template Name|text=This template:}} |
This template: | |
Without "This box:" text | {{navbar|Template Name|plain=y}} |
{{view}} | |
Short version | {{navbar|Template Name|mini=y}} |
{{v}} | |
With brackets | {{navbar|Template Name|brackets=y}} |
This box: | |
With font styling examples (span) | {{navbar|Template Name|fontstyle=color: green; font-style: italic;}} |
This box: | |
With whole-template styling examples (div) | {{navbar|Template Name|style=float:right; background: Beige; padding: 5px; border: 1px solid;}} |
This box: | |
History, move, and watchlist links | {{navbar|template=Template Name|e|t|h|m|w}} |
This box: |
Note that to show the history, move, and watchlist links, |template=
needs to be set to the template value specifically. Individual values can be left out of this list, e.g. {{navbar|template=Template Name|h|m|w}}
will only show the view, history, move, and watchlist links.
Shortcut templates
The mini=y
and plain=y
parameters can be avoided by using the {{v}}
or {{view}}
templates, respectively, instead.
{{view}} and {{v}} also support changing the shown links, for example only view and edit, or only view and talk:
Code | Result |
---|---|
{{view|template=view/doc}} | |
{{view|template=view/doc|talk}} | |
{{view|template=view/doc|talk|edit}} | |
{{v|template=v/doc}} | |
{{v|template=v/doc|t}} | |
{{v|template=v/doc|t|e}} |
Notes
Navbar is contained within a <div>...</div>
in order to accommodate a horizontal unnumbered list. This means it cannot be placed inside a <span>...</span>
or other inline element, because the HTML Tidy extension will 'fix' situations where it finds block elements inside inline elements.
Prepackaged
- {{Navbar-header}}
- Positions on the right edge of the line, often used in non-collapsible navbox heading.
- {{Navbar-collapsible}}
- For use in conjunction with collapsible tables, floats opposite of the / feature.
See also
Compare different edit templates:- {{Ed}} — plain-style edit link surrounded by <small> tags, specifically for templates only
- {{Ed right}} — plain-style edit link surrounded by <small> tags and aligned to right of page, specifically for templates only
- {{Edit}} — plain-style edit link, applicable to all Misplaced Pages namespaces
- {{Edit section}} — edit link surrounded by <div> tags by default which can specify which section to edit on a page, applicable to all Misplaced Pages namespaces
- {{Vedit}} — plain-style edit link which edit with the Misplaced Pages:VisualEditor, applicable to all Misplaced Pages namespaces
Templates with view, talk and edit links:
- {{Navbar}} — navigation bar with configurable caption and view·talk·edit links, specifically for templates only
- {{View}} — navbar-style view·talk·edit links, specifically for templates only
- {{VTE}} & {{V}} — navbar-style V·T·E links (i.e. view·talk·edit links in short forms), specifically for templates only
Other internal link templates, including:
- {{Talk}} – plain talk link
- {{Watch}} – plain link that adds the page to your watchlist
- Category:Internal template-link templates
Template | Collapsible | Image | Groups | Style (body) parameter/s |
---|---|---|---|---|
{{Navbox}} | collapsible | Left/right of body | Yes | Yes |
{{Navbox with collapsible groups}} | collapsible | Left/right of body and/or in each list | Yes | Yes |
{{Navbox with columns}} | collapsible | Left/right of columns | No | Yes |
Type | CSS classes | JavaScript | Collapses when | Custom initial state |
Nesting |
---|---|---|---|---|---|
Collapsible tables | mw-collapsible | jQuery.makeCollapsible | 2 or more autocollapse on page | Yes | Yes |
TemplateData
This is the TemplateData for this template used by TemplateWizard, VisualEditor and other tools. See a monthly parameter usage report for Template:Navbar in articles based on its TemplateData.TemplateData for Navbar
When placed inside a given template, it adds navbar navigational functionality
Parameter | Description | Type | Status | |
---|---|---|---|---|
Template Name | 1 | The name of the template, so links work correctly
| String | required |
Different text | text | Allows custom text to replace the default 'this box'
| String | optional |
Without 'This box:' text | plain | Removes 'This box'
| Number | optional |
Short Version | mini | Shortens text to V T E
| Number | optional |
with brackets | brackets | adds brackets before and after the links
| Number | optional |
Font color | fontstyle | Allows you to change the color of the font (in the format color:green)
| String | optional |
To float to the side | style | Allows the template to float to the side (format=float:right)
| String | optional |