Jump to content

Template:Links to and Template:Links to/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
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}}}}} }}" <!-- target the entire page
-->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: "{{{2|{{FULLPAGENAME}}}}} {{{1}}}" <!-- target the desired term sequence
-->insource:/"#<!-- Preprocess {{{1}}}
Change " to \", / to \/ and a space character to [ _]
-->insource:/"<!-- target the redirect symbol and section name
Preprocess {{{1}}}, changing " 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 | {{{2|{{FULLPAGENAME}}}}}#{{{1}}} }}
|source = {{trim | {{{1}}} }}
|pattern = "
|pattern = "
|replace = "\""
|replace = "\""
Line 65: Line 63:


-->linksto: "{{ trim | {{{2|{{FULLPAGENAME}}}}} }}" <!--
-->linksto: "{{ trim | {{{2|{{FULLPAGENAME}}}}} }}" <!--
Proof: both linksto fullpagename, and matches the given section _inside a template Section link (alias "slink") call_ .
Proof: both linksto fullpagename and matches the given section _inside a template Section link (alias "slink") call_ .
The [Ss](ection )?link finds "section link" or its alias "slink", and in a case insensitive fashion.
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 *[^}]*"<!-- QUOTE the regexp " or / chars
-->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 = "