Template:Template usage: Difference between revisions
Appearance
enable custom prefix parameter usage, remove template namespaces for now |
mv doc to end so it shows template output at top |
||
| Line 1: | Line 1: | ||
<onlyinclude>{{#switch: {{{prefix|{{FULLPAGENAME}}}}} | <onlyinclude>{{#switch: {{{prefix|{{FULLPAGENAME}}}}} | ||
| Line 11: | Line 9: | ||
A filter is always recommended for, what is expected, an insource:/regexp pattern/. | A filter is always recommended for, what is expected, an insource:/regexp pattern/. | ||
-->{{#if:{{{pattern|}}}<!-- Do insource. If no pattern, hastemplate is done. | -->{{#if:{{{pattern|}}}<!-- Do insource. If no pattern, hastemplate is done. | ||
-->| insource:/\{<!-- 1st a space. Start / | -->| insource:/\{<!-- 1st a space. Start /{regexp/ with curly bracket. | ||
-->[{{#invoke:String|sub<!-- | -->[{{#invoke:String|sub<!-- | ||
Now save from an expensive, /regexp/i, case-insensitive search | Now save from an expensive, /regexp/i, case-insensitive search | ||
| Line 30: | Line 28: | ||
Purpose of this template: make inefficient searches fast via tests/limits. | Purpose of this template: make inefficient searches fast via tests/limits. | ||
Start with a space. | Start with a space. | ||
--> {{#if:{{{prefix|}}} | --> {{#if:{{{prefix|}}} | ||
{{#switch:{{{prefix}}} | | {{#switch:{{{prefix}}} | ||
|#default = prefix:{{{prefix}}} | |||
|n = prefix:{{NAMESPACE}}: | |||
|0|: = prefix:{{ns:0}}: | |||
|1 = prefix:{{ns:1}}: | |||
|2 = prefix:{{ns:2}}: | |||
|3 = prefix:{{ns:3}}: | |||
|4 = prefix:{{ns:4}}: | |||
|5 = prefix:{{ns:5}}: | |||
|6 = prefix:{{ns:6}}: | |||
|7 = prefix:{{ns:7}}: | |||
|8 = prefix:{{ns:8}}: | |||
|9 = prefix:{{ns:9}}: | |||
|10 = prefix:{{ns:10}}: | |||
|11 = prefix:{{ns:11}}: | |||
|12 = prefix:{{ns:12}}: | |||
|13 = prefix:{{ns:13}}: | |||
|14 = prefix:{{ns:14}}: | |||
|15 = prefix:{{ns:15}}: | |||
|100 = prefix:{{ns:100}}: | |||
|101 = prefix:{{ns:101}}: | |||
|108 = prefix:{{ns:108}}: | |||
|109 = prefix:{{ns:109}}: | |||
|118 = prefix:{{ns:118}}: | |||
|119 = prefix:{{ns:119}}: | |||
}}<!-- else if prefix not given, filter down to current page name | |||
-->| intitle:{{FULLPAGENAME}} | |||
| within all instances of | for }} template {{ucfirst: {{{template|val}}}}} ] <!-- | }}<!-- end #if --> | ||
}} <!-- end urlencode --> | |||
}}<!-- end fullurl --> </span> Perform a search {{#if: | |||
{{{pattern|}}} | |||
| within all instances of | |||
| for }} template {{ucfirst: {{{template|val}}}}} ] <!-- | |||
DONE. Now inform the user what the search link does. | DONE. Now inform the user what the search link does. | ||
| Line 94: | Line 97: | ||
|#default = in all titles starting with the characters "{{{prefix}}}". | |#default = in all titles starting with the characters "{{{prefix}}}". | ||
}}</onlyinclude> | }}</onlyinclude> | ||
<noinclude>{{Documentation}}</noinclude> | |||
Revision as of 20:40, 27 June 2015
Phase one of two: a test regexp /{{{pattern}}}/. Perform a search for template Val on just this page.
File:Test Template Info-Icon - Version (2).svg Template documentation[create] [purge]