Difference between revisions of "Template:If pagename"
From Geohashing
(Since the new code is so efficient: Adding 6 and 8 character partial matching, as in "/someth*" and "/somethin*".) |
(Longer partial subpage names should of course match first. And padding with # so "/a" doesn't match "/aaaa*".) |
||
Line 10: | Line 10: | ||
| <!--Check for match with "/something"--> | | <!--Check for match with "/something"--> | ||
{{{ /{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}} | {{{ /{{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}} | ||
− | | <!--Check for match with "/ | + | | <!--Check for match with "/somethin*"--> |
− | {{{ /{{lc: {{padleft:| | + | {{{ /{{lc: {{padleft:|8| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}}# }} }}* |
| <!--Check for match with "/someth*"--> | | <!--Check for match with "/someth*"--> | ||
− | {{{ /{{lc: {{padleft:|6| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}} }} }}* | + | {{{ /{{lc: {{padleft:|6| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}}# }} }}* |
− | | <!--Check for match with "/ | + | | <!--Check for match with "/some*"--> |
− | {{{ /{{lc: {{padleft:| | + | {{{ /{{lc: {{padleft:|4| {{#titleparts:{{#if:{{{page|}}}| {{{page|}}} | {{FULLPAGENAME}} }}|0|-1}}# }} }}* <!--Pad with # so "/a" doesn't match "/aaaa*"--> |
| {{{subpage| {{{other|}}} }}} <!--Respecting empty parameter on purpose--> | | {{{subpage| {{{other|}}} }}} <!--Respecting empty parameter on purpose--> | ||
}}} | }}} |