User:AKAAkira/SimpleNav: Difference between revisions
Jump to navigation
Jump to search
m Correcting instances where line breaks messed up formatting. It's been a while since I did this... |
m Switched override priority around. Added extra check to Chapter e case. Removed spaces when it turned out #sub function didn't like 'em between a minus and a number. |
||
Line 4: | Line 4: | ||
<!-- First box, if potential previous page exists --> | <!-- First box, if potential previous page exists --> | ||
<!-- Check1: Checks if | <!-- Check1: Checks if the "back" manual override is used --> | ||
{{#if: {{{b|{{{back|}}} }}} | |||
<!-- Check1 True: | <!-- Check1 True: "back" manual override is being used --> | ||
<!-- | <!-- Check and if page exists, provide link to page with "back" argument placed after current volume number (e.g. Prologue) --> | ||
| {{#if: {{{b|{{{back|}}} }}} | | {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | {{#len: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} }} }} }} }} {{{b|{{{back}}} }}} <!-- SPACE BEFORE {{{b}}} IS IMPORTANT HERE --> | ||
| {{!}} Back to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | {{#len: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} }} }} }} }} {{{b|{{{back}}} }}} | {{{bn|{{{backname|{{{b|{{{back}}} }}} }}} }}} ]] | |||
<!-- Check and if page exists, provide link to page with "back" argument placed after colon (e.g. Volume 1 Prologue) --> | |||
<!-- Check and if page exists, provide link to page with "back" argument placed after | <!-- Reminder: SERIES_TITLE is used here instead of {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }} in case this template is used on pages | ||
without a volume number, such as side story pages --> | |||
| {{!}} Back to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | | | {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | : }} }}:{{{b|{{{back}}} }}} <!-- NO SPACE BEFORE {{{b}}} IS IMPORTANT HERE --> | ||
| {{!}} Back to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | : }} }}:{{{b|{{{back}}} }}} | {{{bn|{{{backname|{{{b|{{{back}}} }}} }}} }}} ]] | |||
<!-- Check and if page exists, provide link to page with "back" argument encompassing the entire link (e.g. "Main Page") --> | |||
| {{#ifexist: {{{b|{{{back}}} }}} | |||
| {{!}} Back to [[ {{{b|{{{back}}} }}} | {{{bn|{{{backname|{{{b|{{{back}}} }}} }}} }}} ]] | |||
}} | }} | ||
}} | }} | ||
}} | |||
<!-- Check1 False: manual override not being used --> | |||
<!-- Check2: Checks if there is anything after the volume number, and whether pagetitle has the word "volume" in it --> | |||
{{#ifeq: {{#expr: {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | 1 | 0 }} and {{#if: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | {{#len: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} }} }} | 1 | 0 }} }} | |||
| 1 | |||
<!-- Check2 | <!-- Check2 True: there's stuff after the volume number, assume it's a chapter page --> | ||
<!-- Determine what chapter page it is, and then provide link to page naturally before it --> | <!-- Determine what chapter page it is, and then provide link to page naturally before it --> | ||
<!-- Order is like so: | <!-- Order is like so: | ||
Line 252: | Line 252: | ||
<!-- Only meant for those pages that end in Chapter x --> | <!-- Only meant for those pages that end in Chapter x --> | ||
| {{#ifeq: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} | | {{#ifeq: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} | ||
| {{{s|{{{start|1 }}} }}} | | {{{s|{{{start|1 }}} }}} | ||
Line 266: | Line 266: | ||
| {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | | {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | ||
-->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | -->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | ||
| {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} | | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} | ||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} - 1 }} | | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} - 1 }} | ||
}} | }} | ||
| {{!}} Back to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | | {{!}} Back to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | ||
-->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | -->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | ||
| {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} | | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} | ||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} - 1 }} | | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} - 1 }} | ||
}} <!-- | }} <!-- | ||
-->| {{{bn|{{{backname|Chapter {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} - 1 }} }}} }}} | -->| {{{bn|{{{backname|Chapter {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} - 1 }} }}} }}} | ||
]] | ]] | ||
}} | }} | ||
Line 281: | Line 281: | ||
<!-- None of the above applies. First box not created --> | <!-- None of the above applies. First box not created --> | ||
}} | }} | ||
<!-- | <!-- Check2 False: there's nothing after the volume number, assume it's a volume page --> | ||
| {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }}{{#replace: {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }} | | {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }}{{#replace: {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }} | ||
| {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} | |||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} - 1 }} | |||
}} | |||
| {{!}} Back to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }}{{#replace: {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }} | |||
| {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} | |||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} - 1 }} | |||
}} <!-- | |||
-->| {{{bn|{{{backname|Volume {{#expr: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} - 1 }} }}} }}} | |||
]] | |||
}} | |||
}} | }} | ||
}} | }} | ||
Line 301: | Line 301: | ||
to keep out an awkward extra space from template --> | to keep out an awkward extra space from template --> | ||
<!-- Last box, if potential next page exists --> | <!-- Last box, if potential next page exists --> | ||
<!-- Check3 | <!-- Check3: Checks if the "forward" manual override is used --> | ||
{{#if: {{{f|{{{forward|}}} }}} | |||
<!-- Check3 True: "forward" manual override is being used --> | |||
<!-- Check and if page exists, provide link to page with "forward" argument placed after current volume number (e.g. Epilogue) --> | |||
| {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | {{#len: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} }} }} }} }} {{{f|{{{forward}}} }}} <!-- SPACE BEFORE {{{f}}} IS IMPORTANT HERE --> | |||
| {{!}} Forward to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | {{#len: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} }} }} }} }} {{{f|{{{forward}}} }}} | {{{fn|{{{forwardname|{{{f|{{{forward}}} }}} }}} }}} ]] | |||
<!-- Check and if page exists, provide link to page with "back" argument placed after colon (e.g. Volume 2 Epilogue) --> | |||
<!-- Reminder: SERIES_TITLE is used here instead of {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }} in case this template is used on pages | |||
without a volume number, such as side story pages --> | |||
| {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | : }} }}:{{{f|{{{forward}}} }}} <!-- NO SPACE BEFORE {{{f}}} IS IMPORTANT HERE --> | |||
| {{!}} Forward to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | : }} }}:{{{f|{{{forward}}} }}} | {{{fn|{{{forwardname|{{{f|{{{forward}}} }}} }}} }}} ]] | |||
<!-- Check and if page exists, provide link to page with "forward" argument encompassing the entire link (e.g. "Main Page") --> | |||
| {{#ifexist: {{{f|{{{forward}}} }}} | |||
| {{!}} Back to [[ {{{f|{{{forward}}} }}} | {{{fn|{{{forwardname|{{{f|{{{forward}}} }}} }}} }}} ]] | |||
}} | }} | ||
}} | }} | ||
}} | |||
<!-- Check3 False: manual override not being used --> | |||
<!-- Check4: Checks if there is anything after the volume number, and whether pagetitle has the word "volume" in it --> | |||
| {{#ifeq: {{#expr: {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | 1 | 0 }} and {{#if: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | {{#len: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} }} }} | 1 | 0 }} }} | |||
| 1 | |||
<!-- Check4 True: there's stuff after the volume number, assume it's a chapter page --> | |||
<!-- Determine what chapter page it is, and then provide link to page naturally after it --> | <!-- Determine what chapter page it is, and then provide link to page naturally after it --> | ||
<!-- Order is like so: | <!-- Order is like so: | ||
Line 371: | Line 372: | ||
whether there is a space between word "Chapter" and the chapter number or not, as well as being | whether there is a space between word "Chapter" and the chapter number or not, as well as being | ||
somewhat lenient if the a word other than "chapter" is being used (e.g. "Story") --> | somewhat lenient if the a word other than "chapter" is being used (e.g. "Story") --> | ||
| {{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | | {{#if: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} | ||
| {{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | |||
| {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} | |||
| {{{e|{{{end}}} }}} | |||
}} | |||
| N/A | |||
}} | }} | ||
Line 438: | Line 442: | ||
| {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | | {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | ||
-->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | -->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | ||
| {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} | | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} | ||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} + 1 }} | | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} + 1 }} | ||
}} | }} | ||
| {{!}} Forward to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | | {{!}} Forward to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} <!-- | ||
-->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | -->{{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} }} | ||
| {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} | | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} | ||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} + 1 }} | | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} + 1 }} | ||
}} <!-- | }} <!-- | ||
-->| {{{fn|{{{forwardname|Chapter {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | - 1 }} + 0 }} }} }} + 1 }} }}} }}} | -->| {{{fn|{{{forwardname|Chapter {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} + 1 }} }}} }}} | ||
]] | ]] | ||
}} | }} | ||
Line 452: | Line 456: | ||
<!-- None of the above applies. Last box not created --> | <!-- None of the above applies. Last box not created --> | ||
}} | }} | ||
<!-- Check4 False: there's nothing after the volume number, assume it's a volume page --> | |||
<!-- | | {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }}{{#replace: {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }} | ||
| {{#ifexist: {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }}{{#replace: {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }} | | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} | ||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} + 1 }} | |||
}} | |||
| {{!}} Forward to [[ {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }}{{#replace: {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }} | |||
| {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} | |||
| {{#expr: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} + 1 }} | |||
}} <!-- | |||
-->| {{{fn|{{{forwardname|Volume {{#expr: {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} }} | 0 | 2 }} + 0 }} }} }} + 1 }} }}} }}} | |||
]] | |||
}} | |||
}} | }} | ||
}} | }} | ||
Line 481: | Line 485: | ||
*Check whether this still works with * or ' in pagename | *Check whether this still works with * or ' in pagename | ||
*<s>Make it tolerant to pages with space after colon</s> | *<s>Make it tolerant to pages with space after colon</s> | ||
*This thing is case-sensitive... | |||
Edit notes (use a text editor to interchange code with capital letters to improve readability): | Edit notes (use a text editor to interchange code with capital letters to improve readability): | ||
Line 538: | Line 543: | ||
*returns all before Volume's e if volume number is not a pure integer | *returns all before Volume's e if volume number is not a pure integer | ||
{{#iferror:{{#expr:{{#sub:{{FULLPAGENAME}}|-2}}+0}}|{{#iferror:{{#expr:{{#sub:{{FULLPAGENAME}}|-1 | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | ||
| {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} | |||
}} | |||
produces the integer CHAPTER_NUM | produces the integer CHAPTER_NUM | ||
*returns nothing if chapter number isn't the last thing in FULLPAGENAME | *returns nothing if chapter number isn't the last thing in FULLPAGENAME | ||
*works only if chapter number does not exceed three or more digits | *works only if chapter number does not exceed three or more digits | ||
</pre> | </pre> | ||
</noinclude> |
Revision as of 07:04, 19 May 2014
Return to Main Page |
Sandbox page for this template. The real page is at Template:SimpleNav.
TODO:
Make it say "Volume" when on Volume page.Make it readableBetter than before, at least...Make it easy to tell what the arguments are asking forInsert "beforename" and "aftername"- Make it work even if there's something after the volume number aside from the usual (e.g. "Preview")
- Check whether this still works with * or ' in pagename
Make it tolerant to pages with space after colon- This thing is case-sensitive...
Edit notes (use a text editor to interchange code with capital letters to improve readability):
In case of multiple layers of argument defaulting (such as in the case of {{{b|{{{before|}}} }}} ), it's important to make sure there's no space immediately after the pipe, or else it may insert an unwanted one (usually right after the page title's colon) {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} | }} produces the zero-based position of SPACE_BEFORE_LAST_WORD *substring-ing -5 allows it to count out the potential space in "Chapter 1" *also, it's important to use #rpos and not #pos here since the last space, or the first space from the /right/, is being looked for *returns -1 if there is no space in title (this is the product of using #rpos and not #pos) {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | : }} }} produces the string SERIES_TITLE *title should not have a colon in it for this helper function to work *returns FULLPAGENAME if string ":" doesn't exist in title, but /should/ be ignorable since it will return false on #ifexist {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | Volume }} }} produces the string ALL_BEFORE_VOLUMES_V *SERIES_TITLE should not have string "Volume" in it for this helper function to work *SERIES_TITLE is not used because this retains the space after a colon, if there is one *returns FULLPAGENAME if string "Volume" does not exist in title but /should/ be ignorable since this is only used in ifexist cases with colon taken out {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }} produces the string ALL_AFTER_VOLUMES_V {{#if: {{#pos: {{FULLPAGENAME}} | Volume }} | {{#expr: {{#pos: {{FULLPAGENAME}} | Volume }} +6 }} }} produces the zero-based position AFTER_VOLUMES_E *SERIES_TITLE should not have string "Volume" in it for this helper function to work *returns nothing if "Volume" does not exist in pagename {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | AFTER_VOLUMES_E }} | 0 | 3 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{#sub: {{FULLPAGENAME}} | AFTER_VOLUMES_E }} | 0 | 2 }} + 0 }} }} }} produces the integer VOL_NUMBER *returns nothing if "volume" does not exist in FULLPAGENAME, or if volume number is not a pure integer *heavily reliant on the fact that NO VOLUME NUMBER GOES INTO THREE DIGITS *(kinda hard to search&replace in notepad, break it into two segments, and remember to turn the line breaks into spaces) {{#sub: {{#sub: {{FULLPAGENAME}} | AFTER_VOLUMES_E }} | {{#len: VOL_NUMBER }} }} produces the string ALL_AFTER_VOLUME_NUMBER *including the space immediately after, though this /should/ be ignorable *returns FULLPAGENAME if "Volume" is not in the FULLPAGENAME *returns all after Volume's e if volume number is not a pure integer {{#sub: {{FULLPAGENAME}} | 0 | {{#pos: {{FULLPAGENAME}} | ALL_AFTER_VOLUME_NUMBER }} }} produces the string ALL_UP_TO_VOLUME_NUMBER *here, while parsing the space included in ALL_AFTER_VOLUME_NUMBER is /ignored/, which means there's a space included right after ALL_UP_TO_VOLUME_NUMBER instead, though again this /should/ be ignorable *returns nothing if "volume" does not exist in FULLPAGENAME *returns all before Volume's e if volume number is not a pure integer {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} produces the integer CHAPTER_NUM *returns nothing if chapter number isn't the last thing in FULLPAGENAME *works only if chapter number does not exceed three or more digits