Template:Search link: Difference between revisions
Appearance
add text and link aliases |
comments, spacing, functionality: use module:String to change any square brackets in "link=" labeled portion so it can label regex searches with the actual query |
||
| Line 1: | Line 1: | ||
{{main other | {{main other | ||
| 1={{Warning|{{tl|Search link}} should not be used in [[WP:WIAA|articles]] as links to "search result pages" are among the [[WP:LINKSTOAVOID|links normally to be avoided]].}} | | 1={{Warning|{{tl|Search link}} should not be used in [[WP:WIAA|articles]] as links to "search result pages" are among the [[WP:LINKSTOAVOID|links normally to be avoided]].}} | ||
| 2=<span class="plainlinks">[{{fullurl:Special:Search|search={{ | | 2=<span class="plainlinks">[{{fullurl:Special:Search|search=<!-- | ||
-->{{urlencode:{{{1|{{{text|}}}}}}}}<!-- Given query | |||
-->{{#if:{{{ns|}}} <!-- ns = all / ns0=1&ns5=1 --> | |||
| {{#ifeq: {{{ns | | {{#ifeq: {{{ns}}} | all | ||
| &ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1<!-- | | &ns0=1&ns1=1&ns2=1&ns3=1&ns4=1&ns5=1&ns6=1&ns7=1&ns8=1&ns9=1<!-- | ||
-->&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns100=1&ns101=1 | -->&ns10=1&ns11=1&ns12=1&ns13=1&ns14=1&ns15=1&ns100=1&ns101=1 | ||
| Line 47: | Line 47: | ||
#if:{{{20|}}}| &{{lc:{{{20|}}}}}=1 | #if:{{{20|}}}| &{{lc:{{{20|}}}}}=1 | ||
}}&fulltext=Search | }}&fulltext=Search | ||
}} {{#if:{{{2|{{{link|}}}}}}| | }}<!-- Done with [URL part. Now for the name] part of [URL name]. | ||
}}{{#if: {{{ns|}}}{{{3|}}}{{{4|}}}{{{5|}}}{{{6|}}}{{{7|}}}{{{8|}}}{{{9|}}}{{{10|}}}{{{11|}}}{{{12|}}}{{{13|}}}{{{14|}}}{{{15|}}}{{{16|}}}{{{17|}}}{{{18|}}}{{{19|}}}{{{20|}}} | (The URL part already escapes square brackets [ ], in urlencode %5B %5D.) | ||
You'll see the space. The "replace" wrappers escape square brackets in name. | |||
--> {{#invoke:String|replace<!-- | |||
-->|{{#invoke:String|replace | |||
|{{#if: | |||
{{{2|{{{link|}}}}}} | |||
|{{{2|{{{link|}}}}}} | |||
|{{{1|{{{text|}}}}}}<!-- | |||
-->}}<!-- | |||
-->|[|[}}<!-- ] with its html symbol | |||
-->|]|]}}<!-- ] with its html symbol | |||
-->]</span> | |||
}}<!-- End of template main | |||
Output a hidden category: -->{{#if: {{{ns|}}}{{{3|}}}{{{4|}}}{{{5|}}}{{{6|}}}{{{7|}}}{{{8|}}}{{{9|}}}{{{10|}}}{{{11|}}}{{{12|}}}{{{13|}}}{{{14|}}}{{{15|}}}{{{16|}}}{{{17|}}}{{{18|}}}{{{19|}}}{{{20|}}} | |||
| [[Category:Search link templates with namespace parameters]] | | [[Category:Search link templates with namespace parameters]] | ||
}}<noinclude> | }}<noinclude> | ||
Revision as of 10:06, 12 July 2015
File:Test Template Info-Icon - Version (2).svg Template documentation[create] [purge]