Difference between pages "Template:Links to" and "Template:Links to/sandbox"
(Difference between pages)
Jump to navigation
Jump to search
imported>Jdaloner m ("{{plainlink" --> "{{plain link") |
imported>Jdaloner m ("{{plainlink" --> "{{plain link") |
||
Line 33: | Line 33: | ||
-->|{{fullurl:Special:Search|search={{urlencode:<!-- | -->|{{fullurl:Special:Search|search={{urlencode:<!-- | ||
-->{{ trim | {{{3|all}}} }}: <!-- | -->{{ trim | {{{3|all}}} }}: <!-- | ||
− | -->linksto: "{{ trim | {{{2|{{FULLPAGENAME}}}}} }}" <!-- | + | -->linksto: "{{ trim | {{{2|{{FULLPAGENAME}}}}} }}" <!-- trim any spaces on outer boundary of insource arg |
− | |||
Proof: both linksto and matches "#section". | Proof: both linksto and matches "#section". | ||
Matching "#section" requires a regexp that permits metachars in the section name, and equates _ to space char. | Matching "#section" requires a regexp that permits metachars in the section name, and equates _ to space char. | ||
− | + | -->insource:/"#<!-- Preprocess {{{1}}} | |
− | -->insource:/"<!-- | + | Change " to \", / to \/ and a space character to [ _] |
− | |||
-->{{#invoke:String|replace | -->{{#invoke:String|replace | ||
|source = | |source = | ||
Line 45: | Line 43: | ||
|source = | |source = | ||
{{#invoke:String|replace | {{#invoke:String|replace | ||
− | |source = {{trim | | + | |source = {{trim | {{{1}}} }} |
|pattern = " | |pattern = " | ||
|replace = "\"" | |replace = "\"" | ||
Line 65: | Line 63: | ||
-->linksto: "{{ trim | {{{2|{{FULLPAGENAME}}}}} }}" <!-- | -->linksto: "{{ trim | {{{2|{{FULLPAGENAME}}}}} }}" <!-- | ||
− | Proof: both linksto fullpagename | + | Proof: both linksto fullpagename and matches the given section _inside a template Section link (alias "slink") call_ . |
− | The [Ss](ection )?link finds "section link" | + | The [Ss](ection )?link finds "section link" alias "slink", and in a case insensitive fashion. |
The [^}]* construct searches inside the template call. | The [^}]* construct searches inside the template call. | ||
This catches both {{section link || section name }} and {{section link| fullpagename | section name}}. | This catches both {{section link || section name }} and {{section link| fullpagename | section name}}. | ||
− | |||
Acceptably, it misses when other kinds of braces are inside: {{section link | {{markup}} | section name}}. | Acceptably, it misses when other kinds of braces are inside: {{section link | {{markup}} | section name}}. | ||
− | -->insource:/\{\{ *[Ss](ection )?link *[^}]*"<!-- | + | -->insource:/\{\{ *[Ss](ection )?link *[^}]*"<!-- quotation mark starts escaping any metacharacters in section name |
− | |||
-->{{#invoke:String|replace | -->{{#invoke:String|replace | ||
|source = | |source = | ||
Line 78: | Line 74: | ||
|source = | |source = | ||
{{#invoke:String|replace | {{#invoke:String|replace | ||
− | |||
|source = {{trim | {{{1}}} }} | |source = {{trim | {{{1}}} }} | ||
|pattern = " | |pattern = " |