Template:SimpleNav: Difference between revisions
Jump to navigation
Jump to search
m AKAAkira moved page User:AKAAkira/SimpleNav to Template:SimpleNav: Thoroughly tested, shouldn't break |
m Usage notes, decided to give manual overrides solid arguments |
||
| Line 2: | Line 2: | ||
|- | |- | ||
{{#if:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}| | {{#if:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}| | ||
{{#if:{{{ | {{#if:{{{b|}}}|{{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}{{{b}}}|{{!}} Back to [[{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}{{{b}}}|{{{b}}}]]| | ||
{{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|:}}}}:{{{ | {{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|:}}}}:{{{b}}}|{{!}} Back to [[{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|:}}}}:{{{b}}}|{{{b}}}]]}}}}| | ||
{{#switch:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}} | {{#switch:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}} | ||
|Illustrations={{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|Volume}}}}{{#replace:{{#sub:{{PAGENAME}}|{{#pos:{{PAGENAME}}|Volume}}}}|{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|{{#expr:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|0|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}| }}}}-1}}}} Afterword|{{!}} Back to [[{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|Volume}}}}{{#replace:{{#sub:{{PAGENAME}}|{{#pos:{{PAGENAME}}|Volume}}}}|{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|{{#expr:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|0|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}| }}}}-1}}}} Afterword|Volume {{#expr:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|0|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}-1}} Afterword]]| | |Illustrations={{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|Volume}}}}{{#replace:{{#sub:{{PAGENAME}}|{{#pos:{{PAGENAME}}|Volume}}}}|{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|{{#expr:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|0|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}| }}}}-1}}}} Afterword|{{!}} Back to [[{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|Volume}}}}{{#replace:{{#sub:{{PAGENAME}}|{{#pos:{{PAGENAME}}|Volume}}}}|{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|{{#expr:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}|0|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#pos:{{PAGENAME}}|Volume}}+6}}}}| }}}}-1}}}} Afterword|Volume {{#expr:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|0|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}-1}} Afterword]]| | ||
| Line 24: | Line 24: | ||
| Return to [[{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|:}}}}|Main Page]] | | Return to [[{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|:}}}}|Main Page]] | ||
{{#if:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}| | {{#if:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}| | ||
{{#if:{{{ | {{#if:{{{f|}}}|{{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}{{{f}}}|{{!}} Forward to [[{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}{{{f}}}|{{{f}}}]]| | ||
{{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|:}}}}:{{{ | {{#ifexist:{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|:}}}}:{{{f}}}|{{!}} Forward to [[{{#sub:{{PAGENAME}}|0|{{#pos:{{PAGENAME}}|:}}}}:{{{f}}}|{{{f}}}]]}}}}| | ||
{{#switch:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}} | {{#switch:{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}} | ||
|Illustrations={{#ifexist:{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}Prologue|{{!}} Forward to [[{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}Prologue|Prologue]]| | |Illustrations={{#ifexist:{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}Prologue|{{!}} Forward to [[{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}}}}}Prologue|Prologue]]| | ||
| Line 49: | Line 49: | ||
<noinclude> | <noinclude> | ||
<pre> | <pre> | ||
Usage notes: | |||
On Full Page pages: simply type in the template: {{SimpleNav}}. The template will take care of the rest. | |||
On individual chapters: type in {{SimpleNav|s=##|e=##}}, where each respective numbers are the chapter | |||
that the book Starts and Ends on. For example, SAO v4 contains chapters 5 to 9, so for that, I would | |||
type in s=5 and e=9. (Note that the s argument defaults to 1, so it's not necessary to type in unless | |||
the book starts on a chapter other than 1. Also note that the e argument only has to be typed in if | |||
the page in question links to (i.e. Epilogue, Afterword, Author Notes, or the next volume's Illustrations) | |||
or is a final chapter. | |||
If the auto-function doesn't work at all, use the manual override: {{SimpleNav|b=link here|f=link2 here}}, | |||
where each respective "link here"s are the chapter or volume and chapter target. Please note that the | |||
links must be spelled EXACTLY as it is in the page title/URL (for example, Chapter2 vs Chapter 2). | |||
Examples: | |||
To target Zero_no_Tsukaima:Volume1_Story2_Chapter1 from Zero_no_Tsukaima:Volume1_Story1_Chapter3, | |||
insert f=Story2_Chapter1 | |||
To target Sword_Art_Online:Volume_10_Interlude_II from Sword_Art_Online:Volume_10_Chapter_4, | |||
insert f=Interlude_II | |||
To target Zero_no_Tsukaima:Volume4_Prologue from Zero_no_Tsukaima:Volume_3_Chapter_10 (this is not | |||
chronological, there's the v4 Illustrations in the middle), insert f=Volume4_Prologue | |||
Warning: This template is only guaranteed to work on pages which has their naming conventions CONSISTENT. Specifically: | Warning: This template is only guaranteed to work on pages which has their naming conventions CONSISTENT. Specifically: | ||
*There must be a colon (:) after the series title; | *There must be a colon (:) after the series title; | ||
| Line 58: | Line 77: | ||
must be correct and the chapter must IMMEDIATELY succeed the former, with a space in between. | must be correct and the chapter must IMMEDIATELY succeed the former, with a space in between. | ||
Edit notes: | |||
{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|:}}}} | {{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|:}}}} | ||
produces the title of the series | produces the title of the series | ||
Revision as of 08:28, 18 May 2013
| Return to Main Page |
Usage notes:
On Full Page pages: simply type in the template: {{SimpleNav}}. The template will take care of the rest.
On individual chapters: type in {{SimpleNav|s=##|e=##}}, where each respective numbers are the chapter
that the book Starts and Ends on. For example, SAO v4 contains chapters 5 to 9, so for that, I would
type in s=5 and e=9. (Note that the s argument defaults to 1, so it's not necessary to type in unless
the book starts on a chapter other than 1. Also note that the e argument only has to be typed in if
the page in question links to (i.e. Epilogue, Afterword, Author Notes, or the next volume's Illustrations)
or is a final chapter.
If the auto-function doesn't work at all, use the manual override: {{SimpleNav|b=link here|f=link2 here}},
where each respective "link here"s are the chapter or volume and chapter target. Please note that the
links must be spelled EXACTLY as it is in the page title/URL (for example, Chapter2 vs Chapter 2).
Examples:
To target Zero_no_Tsukaima:Volume1_Story2_Chapter1 from Zero_no_Tsukaima:Volume1_Story1_Chapter3,
insert f=Story2_Chapter1
To target Sword_Art_Online:Volume_10_Interlude_II from Sword_Art_Online:Volume_10_Chapter_4,
insert f=Interlude_II
To target Zero_no_Tsukaima:Volume4_Prologue from Zero_no_Tsukaima:Volume_3_Chapter_10 (this is not
chronological, there's the v4 Illustrations in the middle), insert f=Volume4_Prologue
Warning: This template is only guaranteed to work on pages which has their naming conventions CONSISTENT. Specifically:
*There must be a colon (:) after the series title;
*Both the words Volume and Chapter are in the title, spelled correctly;
*The word Volume must immediately precede the volume number;
*The word Chapter must immediately precede the chapter number;
*For the above two, the latter must succeed the former; and
*For the auto-navigate function to work, the s (starting chapter) and e (ending chapter) arguments
must be correct and the chapter must IMMEDIATELY succeed the former, with a space in between.
Edit notes:
{{#sub:{{PAGENAME}}|0|{{#rpos:{{PAGENAME}}|:}}}}
produces the title of the series
{{#sub:{{PAGENAME}}|{{#rpos:{{PAGENAME}}|:}}}}
produces everything after the colon in the title
{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}
produces the zero-based position right after 'e' in the word "Volume" in the title
{{#sub:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}|
{{#pos:{{#sub:{{PAGENAME}}|{{#expr:{{#rpos:{{PAGENAME}}|Volume}}+6}}}}| }}}}
produces everything after the volume number (including the space immediately after, though this should be ignorable).