Template:Links to and Template:Links to/sandbox: Difference between pages
Appearance
(Difference between pages)
Content deleted Content added
m "{{plainlink" --> "{{plain link" |
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 |
||
(trims 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: |
-->insource:/"#<!-- Preprocess {{{1}}} |
||
⚫ | |||
-->insource:/"<!-- target the redirect symbol and section name |
|||
⚫ | |||
-->{{#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}}. |
||
Alternatively, using ({{{2}}} *\| *)? could be used to ensure fewer false positives if {{slink}} ever gets high use. |
|||
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 |
||
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 | ({{{2|{{FULLPAGENAME}}}}} *\{{!}} *)?{{{1}}} }}<!-- overkill? --> |
|||
|source = {{trim | {{{1}}} }} |
|source = {{trim | {{{1}}} }} |
||
|pattern = " |
|pattern = " |