Difference between revisions of "Template:Strip basepage"
From Complex Time
(Created page with "<noinclude>Both #titleparts & SUBPAGENAME do poorly with slashes. For example, using the title Base/Page/Sub/Page where the base is Base/Page and the sub is Sub/Page: ;<nowi...") |
|||
Line 10: | Line 10: | ||
The correct answer is '''Sub/Page'''. | The correct answer is '''Sub/Page'''. | ||
− | This template is intended to strip the current PAGENAME plus a / from the parameter. The idea is to show the subpage correctly while on the base page. So while on Base/Page, call <nowiki>{{Strip basepage:Base/Page/Sub/Page}}</nowiki> and it will spit out the correct answer. Requires StringFunctions.</noinclude><includeonly>{{#replace: | + | This template is intended to strip the current PAGENAME plus a / from the parameter. The idea is to show the subpage correctly while on the base page. So while on Base/Page, call <nowiki>{{Strip basepage:Base/Page/Sub/Page}}</nowiki> and it will spit out the correct answer. Requires StringFunctions.</noinclude><includeonly>{{#replace:{{{1|}}}|{{FULLPAGENAME}}/|}}</includeonly> |
Revision as of 20:37, August 22, 2019
Both #titleparts & SUBPAGENAME do poorly with slashes. For example, using the title Base/Page/Sub/Page where the base is Base/Page and the sub is Sub/Page:
- {{#titleparts:Base/Page/Sub/Page||2}}
- Page/Sub/Page
- {{#titleparts:Base/Page/Sub/Page||-1}}
- Page
- {{SUBPAGENAME:Base/Page/Sub/Page}}
- Page
The correct answer is Sub/Page.
This template is intended to strip the current PAGENAME plus a / from the parameter. The idea is to show the subpage correctly while on the base page. So while on Base/Page, call {{Strip basepage:Base/Page/Sub/Page}} and it will spit out the correct answer. Requires StringFunctions.