Template:Prevnext2: Difference between revisions

From KDE Wiki Sandbox
No edit summary
(avoid little empty box when no prevpage or nextpage is given)
 
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
<includeonly><ul class="pager">
{{#if: {{{prevpage|}}} | <li>[[{{{prevpage}}}|&larr; {{{prevtext|{{{prevpage}}}}}}]]</li> | }}
<li>'''{{#if: {{{index|}}} | [[{{{index}}}|&uarr; {{{indextext|{{PAGENAME}}}}} &uarr;]] | {{{indextext|{{PAGENAME}}}}}}}'''</li>
{{#if: {{{nextpage|}}} | <li>[[{{{nextpage}}}|{{{nexttext|{{{nextpage}}}}}} &rarr;]]</li> | }}
</ul></includeonly><noinclude>
The old code was
{{Input|1=<nowiki>
<includeonly><table align=center id=toc style="width: 95%" class="noprint"><tr>
<includeonly><table align=center id=toc style="width: 95%" class="noprint"><tr>
<td style="text-align: left; width: 33%">{{#if: {{{prevpage|}}} | [[{{{prevpage}}}|&larr; {{{prevtext|{{{prevpage}}}}}}]] | }}</td>
<td style="text-align: left; width: 33%">{{#if: {{{prevpage|}}} | [[{{{prevpage}}}|&larr; {{{prevtext|{{{prevpage}}}}}}]] | }}</td>
<td style="text-align: center; width:  33%">'''{{#if: {{{index|}}} | [[{{{index}}}|&uarr; {{{indextext|{{PAGENAME}}}}} &uarr;]] | {{PAGENAME}}}}'''</td>
<td style="text-align: center; width:  33%">'''{{#if: {{{index|}}} | [[{{{index}}}|&uarr; {{{indextext|{{PAGENAME}}}}} &uarr;]] | {{{indextext|{{PAGENAME}}}}}}}'''</td>
<td style="text-align: right; width: 33%">{{#if: {{{nextpage|}}} | [[{{{nextpage}}}|{{{nexttext|{{{nextpage}}}}}}&rarr;]] | }}</td>
<td style="text-align: right; width: 33%">{{#if: {{{nextpage|}}} | [[{{{nextpage}}}|{{{nexttext|{{{nextpage}}}}}} &rarr;]] | }}</td>
</tr></table></includeonly><noinclude>{{Template:I18n/Language Navigation Bar|Template:Prevnext}}
</tr></table></includeonly><noinclude></nowiki>}}
 
{{Info|This template is a work-in-progress and will probably be re-named to something less obtuse quite soon, so avoid using it just at the moment.}}


Use this template when you want to provide links to the previous and the next sections of the article so the user isn't forced to go back to the index to navigate.
Use this template when you want to provide links to the previous and the next sections of the article so the user isn't forced to go back to the index to navigate.




== How to use this template ==
== Arguments ==
 
<tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
| prevpage  = The path of the previous article.</nowiki><br><nowiki>
| prevtext  = The link name for prevpage.*</nowiki><br><nowiki>
| nextpage  = The path to the next article.*</nowiki><br><nowiki>
| nexttext  = The link name for nextpage.*</nowiki><br><nowiki>
| index    = The path to the manual index.*</nowiki><br><nowiki>
| indextext = The link name for index.*</nowiki><br><nowiki>
}}</nowiki></tt>
 
 
(* - Optional arguments.)


Write
== Example usage ==
Writing this:


<code>{{Prevnext2
<br><tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
| prevpage=path/to/article | nextpage=path/to/article
| prevpage=path/to/article | nextpage=path/to/article</nowiki><br><nowiki>
| prevtext=previous section| nexttext=The next section
| prevtext=previous section| nexttext=The next section</nowiki><br><nowiki>
}}</code>
}}</nowiki></tt><br>


which will be returned as,
Gets you this:
----
----
{{Prevnext2
{{Prevnext2
Line 25: Line 48:
----
----


== Optional arguments ==
== Example usage: omitting arguments ==


The arguments in this template are optional. That is, if there is no previous page to link to, you don't have to include it in the template. You can just write this:
Writing this:


<code>{{Prevnext2
<tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
| nextpage=path/to/article
| nextpage=path/to/article</nowiki><br><nowiki>
| nexttext=The next section
| nexttext=The next section</nowiki><br><nowiki>
}}</code>
}}</nowiki></tt>
 
Which would be rendered as:


Gets you this:
----
----
{{Prevnext2
{{Prevnext2
Line 43: Line 65:
----
----


This works the other way around, too. This:
Writing this:


<code>{{Prevnext2
<tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
| prevpage=path/to/article
| prevpage=path/to/article</nowiki><br><nowiki>
| prevtext=previous section
| prevtext=previous section</nowiki><br><nowiki>
}}</code>
}}</nowiki></tt>


is rendered as:
Gets you this:
----
----
{{Prevnext2
{{Prevnext2
| prevpage=path/to/article  
| prevpage=path/to/article
| prevtext=previous section
| prevtext=previous section
}}
}}
----
----


== Omitting link descriptions ==
== Example usage: the least amount of typing ==
Writing this:


Finally, the link description text doesn't have to be specified, either. The text will default to the name of the article you are linking to. So, the following syntax,
<tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
| nextpage=path/to/article</nowiki><br><nowiki>
| prevpage=path/to/lastsection</nowiki><br><nowiki>
}}</nowiki></tt>


<code>{{Prevnext2
Gets you this:
| nextpage=path/to/article
| prevpage=path/to/lastsection
}}</code>
 
will render as:
----
----
{{Prevnext2
{{Prevnext2
Line 75: Line 96:
----
----


This might be useful in some situations. But often it looks ugly, so try to specify link text whenever you can!
== Example usage: including every argument ==
 
Writing this:
 
<tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
| prevpage=path/to/article      | nextpage=path/to/article</nowiki><br><nowiki>
| prevtext=previous section      | nexttext=The next section</nowiki><br><nowiki>
| index=  {{PAGENAME}}/Manual  | indextext=Contents page</nowiki><br><nowiki>
}}</nowiki></tt>


== Extra options ==
Gets you this:
----
{{Prevnext2
| prevpage=path/to/article    | nextpage=path/to/article
| prevtext=previous section    | nexttext=The next section
| index={{PAGENAME}}/Manual    | indextext=Contents page
}}
----


There are two more completely optional arguments for this template. These replace the text in the middle of the template with a link to wherever you like (most usually the index of the article). To use them, write this:
Writing this:


<code>{{Prevnext2
<tt><nowiki>{{Prevnext2</nowiki><br><nowiki>
| prevpage=path/to/article | nextpage=path/to/article
| nextpage=path/to/article</nowiki><br><nowiki>
| prevtext=previous section| nexttext=The next section
| nexttext=The next section</nowiki><br><nowiki>
| index=path/to/index      | indextext=Go to the contents page
| indextext=Contents section</nowiki><br><nowiki>
}}</code>
}}</nowiki></tt>


which will be rendered as:
Gets you this:
----
----
{{Prevnext2
{{Prevnext2
| prevpage=path/to/article | nextpage=path/to/article
| nextpage=path/to/article
| prevtext=previous section| nexttext=The next section
| nexttext=The next section
| index=path/to/index      | indextext=Contents page
| indextext=Contents section
}}
}}
----
----


== Template source code ==
<code>
<table align=center id=toc style="width: 95%" class="noprint"><tr>
<td style="text-align: left; width: 33%">{{#if: {{{prevpage|}}} | [[{{{prevpage}}}|&larr; {{{prevtext|{{{prevpage}}}}}}]] | }}</td>
<td style="text-align: center; width:  33%">'''{{#if: {{{index|}}} | [[{{{index}}}|&uarr; {{{indextext|{{PAGENAME}}}}} &uarr;]] | {{PAGENAME}}}}'''</td>
<td style="text-align: right; width: 33%">{{#if: {{{nextpage|}}} | [[{{{nextpage}}}|{{{nexttext|{{{nextpage}}}}}}&rarr;]] | }}</td>
</tr></table>
</code>
[[Category:Template]]
[[Category:Template]]

Latest revision as of 08:32, 20 July 2019


The old code was

<includeonly><table align=center id=toc style="width: 95%" class="noprint"><tr>
<td style="text-align: left; width: 33%">{{#if: {{{prevpage|}}} | [[{{{prevpage}}}|← {{{prevtext|{{{prevpage}}}}}}]] | }}</td>
<td style="text-align: center; width:   33%">'''{{#if: {{{index|}}} | [[{{{index}}}|↑ {{{indextext|{{PAGENAME}}}}} ↑]] | {{{indextext|{{PAGENAME}}}}}}}'''</td>
<td style="text-align: right; width: 33%">{{#if: {{{nextpage|}}} | [[{{{nextpage}}}|{{{nexttext|{{{nextpage}}}}}} →]] | }}</td>
</tr></table></includeonly><noinclude>
Information
This template is a work-in-progress and will probably be re-named to something less obtuse quite soon, so avoid using it just at the moment.


Use this template when you want to provide links to the previous and the next sections of the article so the user isn't forced to go back to the index to navigate.


Arguments

{{Prevnext2
| prevpage = The path of the previous article.
| prevtext = The link name for prevpage.*
| nextpage = The path to the next article.*
| nexttext = The link name for nextpage.*
| index = The path to the manual index.*
| indextext = The link name for index.*
}}


(* - Optional arguments.)

Example usage

Writing this:


{{Prevnext2
| prevpage=path/to/article | nextpage=path/to/article
| prevtext=previous section| nexttext=The next section
}}

Gets you this:



Example usage: omitting arguments

Writing this:

{{Prevnext2
| nextpage=path/to/article
| nexttext=The next section
}}

Gets you this:



Writing this:

{{Prevnext2
| prevpage=path/to/article
| prevtext=previous section
}}

Gets you this:



Example usage: the least amount of typing

Writing this:

{{Prevnext2
| nextpage=path/to/article
| prevpage=path/to/lastsection
}}

Gets you this:



Example usage: including every argument

Writing this:

{{Prevnext2
| prevpage=path/to/article | nextpage=path/to/article
| prevtext=previous section | nexttext=The next section
| index= {{PAGENAME}}/Manual | indextext=Contents page
}}

Gets you this:



Writing this:

{{Prevnext2
| nextpage=path/to/article
| nexttext=The next section
| indextext=Contents section
}}

Gets you this: