27,467
edits
(Created page with "{{Code from Wikipedia}} {{lua|Module:Navbar}}") |
(simplified version from wikipedia; omitting "move" option because it's buggy.) |
||
| Line 1: | Line 1: | ||
{{Code from Wikipedia}} | {{Code from Wikipedia}} | ||
{{lua|Module:Navbar}} | {{lua|Module:Navbar}} | ||
{{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 ''in situ'' where it was found, without having track it down through examining transclusion code. | |||
==Usage== | |||
===General=== | |||
When one of the following examples is placed inside a given [[Wikipedia:Navigation templates|template]] (or block of content used for [[Wikipedia:Transclusion#Selective transclusion|selective transclusion]]), 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 [[wikipedia:SUBST|substituted]] 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}} | |||
If the page is moved or renamed the substituted text will need to be updated accordingly. | |||
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 <code><nowiki><includeonly>...</includeonly></nowiki></code> markup, so that it only appears when transcluded. | |||
===Font size and weight === | |||
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 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 <code><nowiki><div>...</div></nowiki></code> tags, and therefore, any surrounding markup cannot include <code><nowiki><span>...</span></nowiki></code> tags, which would cause a "div-span-flip" lint error. | |||
==Examples== | |||
===Required parameters=== | |||
*<code><nowiki>{{navbar|Template Name}}</nowiki></code> – the template name is required. | |||
===Optional parameters=== | |||
{| 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:}} || | |||
|- | |||
| Without "This box:" text || <code><nowiki>{{navbar|Template Name|</nowiki>'''plain'''<nowiki>=y}}</nowiki></code> || {{navbar|Navbar/doc|plain=y}} || {{tl|view}} | |||
|- | |||
| Short version || <code><nowiki>{{navbar|Template Name|</nowiki>'''mini'''<nowiki>=y}}</nowiki></code> || {{navbar|Navbar/doc|mini=y}} || {{tl|v}} | |||
|- | |||
| With brackets || <code><nowiki>{{navbar|Template Name|</nowiki>'''brackets'''<nowiki>=y}}</nowiki></code> || {{navbar|Navbar/doc|brackets=y}} || | |||
|- | |||
| With font styling examples ([[wikipedia:Span and div|span]]) || <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 ([[wikipedia:Span and div|div]]) || <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, and watchlist links || <code><nowiki>{{navbar|template=Template Name|e|t|h|w}}</nowiki></code> || {{navbar|template=Navbar/doc|e|t|h|w}} | |||
|} | |||
Note that to show the history, 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|w}}</nowiki></code> will only show the view, history, and watchlist links. | |||