User:AKAAkira/SimpleNav: Difference between revisions

From Baka-Tsuki
Jump to navigation Jump to search
AKAAkira (talk | contribs)
Reversed order so pages not in a volume but still ends in a number might end up in the case where their final number is manipulated. Added more tolerance to space after colon.
AKAAkira (talk | contribs)
m Forgot to trim extra...
 
(3 intermediate revisions by the same user not shown)
Line 102: Line 102:
                       }}
                       }}


             <!-- Second guess True: previous volume Afterword page exists -->
             <!-- Second guess True: previous volume Afterwords page exists -->
           | {{!}} Back to [[ {{#replace:
           | {{!}} Back to [[ {{#replace:
<!-- (2a) -->                  {{FULLPAGENAME}}
<!-- (2a) -->                  {{FULLPAGENAME}}
Line 111: Line 111:
<!-- (2b) -->                                    {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }}
<!-- (2b) -->                                    {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }}
<!-- (2c) -->                                  | {{#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 }} }} }} Illustrations
<!-- (2c) -->                                  | {{#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 }} }} }} Illustrations
<!-- (2d) -->                                  | {{#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 }} Afterword
<!-- (2d) -->                                  | {{#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 }} Afterwords
                                               }}
                                               }}
                             }}} }}}
                             }}} }}}
Line 194: Line 194:


                   <!-- Fifth guess False: previous volume Epilogue page doesn't exist -->
                   <!-- Fifth guess False: previous volume Epilogue page doesn't exist -->
                   <!-- Sixth guess: the final chapter of last volume is "Illustrations" -->
                   <!-- First box will not be created -->
                | {{#ifexist: {{#replace:
 
                                <!-- Replace use #6 -->
 
<!-- (6a) -->                  {{FULLPAGENAME}}
<!-- (6c) -->                | {{#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 }} }} }} Illustrations
<!-- (6d) -->                | {{#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 }} Illustrations
                              }}
 
                    <!-- Sixth guess True: previous volume Illustrations page exists -->
                  | {{!}} Back to [[ {{#replace:
<!-- (6a) -->                          {{FULLPAGENAME}}
<!-- (6b) -->                        | {{#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 }} }} }} Illustrations
<!-- (6c) -->                        | {{#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 }} Illustrations
                                    }} <!--
                              -->|  {{{bn|{{{backname|{{#replace:
<!-- (6b) -->                                            {{#sub: {{FULLPAGENAME}} | {{#pos: {{FULLPAGENAME}} | Volume }} }}
<!-- (6c) -->                                          | {{#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 }} }} }} Illustrations
<!-- (6d) -->                                          | {{#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 }} Illustrations
                                                      }}
                                    }}} }}}
                                  ]]
 
                    <!-- Sixth guess False: previous volume Illustrations page doesn't exist -->
                    <!-- First box will not be created -->
                  }}
                 }}
                 }}
               }}
               }}
Line 269: Line 243:
         }}
         }}


       <!-- Only meant for those pages that end in Chapter x -->
       <!-- Only meant for those pages that end in a chapter number -->
     | {{#ifeq: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }}
     | {{#ifeq: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }}
       | {{{s|{{{startchapter|1 }}} }}}
       | {{{s|{{{startchapter|1 }}} }}}


Line 284: Line 258:
       | {{#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 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }}
                                 | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} - 1 }}
                                 | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }} - 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 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }}
                                 | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} - 1 }}
                                 | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }} - 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 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }} - 1 }} }}} }}}
                         ]]
                         ]]
         }}
         }}
Line 392: Line 366:


       <!-- Blank cases defaults their return to the same one as the next case that has one -->
       <!-- Blank cases defaults their return to the same one as the next case that has one -->
       <!-- This case is for when the page is on Chapter {{{e}}}; the use of #replace perserves the format
       <!-- This case is for when the page is on Chapter {{{e}}}; it checks the last number against {{{e}}},
          whether there is a space between word "Chapter" and the chapter number or not, as well as being
           and if they're the same, it returns Chapter {{{e}}} -->
           somewhat lenient if the a word other than "chapter" is being used (e.g. "Story") -->
     | {{#ifeq: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }}
     | {{#if: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }}
       | {{{e|{{{endchapter}}} }}}
       | {{#replace: {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} |  }} }}
      | {{#sub: {{FULLPAGENAME}} | {{#rpos: {{#sub: {{FULLPAGENAME}} | 0 | -3 }} |   }} }}
        | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }}
        | {{{e|{{{endchapter}}} }}}
        }}
       | N/A
       | N/A
       }}
       }}
Line 462: Line 433:
         }}
         }}


       <!-- Only meant for those pages that end in Chapter x, except Chapter {{{e}}} -->
       <!-- Only meant for those pages that end in a chapter number, except Chapter {{{e}}} -->
     | {{#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 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }}
                     | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} + 1 }}
                     | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }} + 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 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }}
                               | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }} }} + 1 }}
                               | {{#expr: {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }} + 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 }} | {{#sub: {{FULLPAGENAME}} | -1 }} }} + 1 }} }}} }}}
                         ]]
                         ]]
       }}
       }}
Line 554: Line 525:


{{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }}
{{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -2 }} + 0 }}
| {{#iferror: {{#expr: {{#sub: {{FULLPAGENAME}} | -1 }} + 0 }} }}
| {{#sub: {{FULLPAGENAME}} | -1 }}
}}
}}
produces the integer CHAPTER_NUM
produces the integer CHAPTER_NUM
*returns nothing if chapter number isn't the last thing in FULLPAGENAME
*returns the final character in PAGENAME 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>
</noinclude>

Latest revision as of 23:46, 26 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 readable Better than before, at least...
  • Make it easy to tell what the arguments are asking for
  • Insert "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 }}
| {{#sub: {{FULLPAGENAME}} | -1 }}
}}
produces the integer CHAPTER_NUM
*returns the final character in PAGENAME if chapter number isn't the last thing in FULLPAGENAME
*works only if chapter number does not exceed three or more digits