Difference between revisions of "Template:Links to/testcases"
imported>Cpiral (→top: finish external-links-style table and recording observations (mw:extension:linksearch is deprecated)) |
imported>Cpiral (→top: theory shows 10 ways to match ways URL-styled internall links could be made. That's a lot to ask users. Insource has no OR.) |
||
| Line 1: | Line 1: | ||
| − | {{Testcases notice <!--|toc=on-->}} | + | {{ Testcases notice <!--|toc=on-->}} |
Each test says "On behalf of the parent page (namespace:basename, Template:Linksto), | Each test says "On behalf of the parent page (namespace:basename, Template:Linksto), | ||
| Line 9: | Line 9: | ||
Required links, or patterns that simulate links, linksto on this page to work: | Required links, or patterns that simulate links, linksto on this page to work: | ||
:*[[../sandbox]] simulates linksto mechanism for wikilinks | :*[[../sandbox]] simulates linksto mechanism for wikilinks | ||
| − | :*<kbd>{<nowiki/>{Section link|Template:Linksto| | + | :*<kbd>{<nowiki/>{ Section link|Template:Linksto|See also }}</kbd> |
| − | :*{{section link|Template:Linksto/doc| | + | :*{{ section link | Template:Linksto/doc | See also }} |
| − | :*[[../doc# | + | :*[[ ../doc#See also ]] (linksto only finds wikilinks, nothing else) |
| − | :*[[../]] (linksto only finds wikilinks, nothing else) | + | :*[[ ../ ]] (linksto only finds wikilinks, nothing else) |
#Section link Template:Linksto Question [../|sublinks]]? | #Section link Template:Linksto Question [../|sublinks]]? | ||
#Section link Template:Linksto Question "''tick''" marks? | #Section link Template:Linksto Question "''tick''" marks? | ||
| Line 23: | Line 23: | ||
#Section link Template:Linksto THis "has"/all the_issues | #Section link Template:Linksto THis "has"/all the_issues | ||
| − | {|class=wikitable | + | {| class=wikitable |
| − | |+ | + | |+ URL-styled links to [[../doc#See also]] |
| − | ! | + | ! What they write. |
| − | ! | + | ! How we match. |
|- | |- | ||
| − | |{{canonicalurl: | + | | {{ canonicalurl: template:linksto/doc#See also }} <br/> |
| − | {<nowiki/>{canonicalurl:Template:Linksto/doc# | + | {<nowiki/>{ canonicalurl: Template:Linksto/doc#See also }} |
| − | | | + | | insource:"canonicalurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/ |
| + | insource:"canonicalurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/ | ||
|- | |- | ||
| − | |[{{ | + | | [{{ fullurl: template:linksto/doc#See also }}] <br/> |
| − | + | [{{ fullurl: Template:linksto/doc#See also }}] <br/> | |
| − | | | + | [{<nowiki/>{ fullurl: Template:linksto/doc#See also }}] |
| + | | insource:"https fullurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/ | ||
| + | insource:"fullurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}]"/ | ||
|- | |- | ||
| − | | [ | + | | [//en.wikipedia.org/wiki/template:linksto/doc#See_also] <br/> |
| − | + | [<nowiki/>/<nowiki/>/en.wikipedia.org/wiki/template:<mark>l</mark>inksto/doc#See_also] | |
| − | + | | insource:"https {{SERVER}} wiki {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/ <br/> | |
| − | + | insource:"https {{ SERVER }}{{ localurl: {{{2}}} }} {{{1}}}" insource:/"#{{{1}}}"/ <br/> | |
| − | + | insource:"{{SERVER}} wiki {{{2}}} {{{1}}}" insource:/"#{{{1}}}]"/ <br/> | |
| + | insource:"{{ SERVER }}{{ localurl: {{{2}}} }} {{{1}}}" insource:/"#{{{1}}}]"/ | ||
|- | |- | ||
| − | | | + | | https:{{SERVER}}{{localurl:template:linksto/doc}}#{{anchorencode:See also}} <br/> |
| − | + | https:{<nowiki/>{SERVER}}{<nowiki/>{localurl:template:linksto/doc}}#{<nowiki/>{anchorencode:See also}} | |
| − | + | | insource:"server localurl {{{2}}} anchorencode {{{1}}}" insource:/"#{{{1}}}]"/ <br/> | |
| − | + | insource:"https server localurl {{{2}}} anchorencode {{{1}}}" insource:/"#{{{1}}}"/ | |
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
|} | |} | ||
Regex pattern matching observations for the external-style links: | Regex pattern matching observations for the external-style links: | ||
| − | * <code> | + | * {{ sl|template:insource:Urlencode|<code>Urlencode</code> is used}} for parameters in URL queries, not internal URL-styled links. |
| − | * <code>{{Localurl</code> and <code>{{anchorencode</code> are | + | * <code>{{ Localurl</code> and <code>{{ anchorencode</code> are used in tandem with SERVER. |
| − | * <code>{{ | + | * <code>https:{{fullurl</code> or <code>https:{{SERVER</code> could be used instead of <code>[{{fullurl</code> or <code>[{{SERVER</code> |
| − | * <code>{{canonicalurl</code> does not need [brackets], but could have them [{{canonicalurl:{{FULLPAGENAME}}}} | + | * <code>{{ canonicalurl</code> does not need [brackets], but could have them [{{ canonicalurl: {{ FULLPAGENAME}} }} |
| − | * <code>{{fullurl</code> must be <code>[{{fullurl]</code> not <code>[ {{fullurl ]</code> with spaces | + | * <code>{{ fullurl</code> must be <code>[{{ fullurl]</code> not <code>[ {{ fullurl ]</code> with spaces |
| − | |||
== [[Template:{{TEMPLATENAME|testcases}}/sandbox|Sandbox version]] == | == [[Template:{{TEMPLATENAME|testcases}}/sandbox|Sandbox version]] == | ||
Revision as of 12:13, 11 December 2015
| 42px | This is the template test cases page for the sandbox of Template:Links to. Script error: No such module "Purge". to update the examples. If there are many examples of a complicated template, later ones may break due to limits in MediaWiki, see the HTML comment "NewPP limit report" in the rendered page. You can also use Special:ExpandTemplates to examine the results of template uses. You can test how this page looks in the different skins with these links: |
Each test says "On behalf of the parent page (namespace:basename, Template:Linksto), what links to section X"? There is no section X at Template:Linksto, but the query only ever looks for the pattern #X. It relies on the high probability that if a page is found to link "here" and it has also one of my section names, and preceded by a # sign, it probably does.
Required links, or patterns that simulate links, linksto on this page to work:
- Template:Links to/sandbox simulates linksto mechanism for wikilinks
- {{ Section link|Template:Linksto|See also }}
- Script error: No such module "Section link".
- Template:Links to/doc#See also (linksto only finds wikilinks, nothing else)
- Template:Links to (linksto only finds wikilinks, nothing else)
- Section link Template:Linksto Question [../|sublinks]]?
- Section link Template:Linksto Question "tick" marks?
- Section link Template:Linksto THis has/all/ the issues
- Section link Template:Linksto THis has" all the issues
- Section link Template:Linksto THis has all the_issues
- Section link Template:Linksto THis_has_all_the_issues
- Section link Template:Linksto THis has/all the issues
- Section link Template:Linksto THis "has" all the issues
- Section link Template:Linksto THis "has"/all the_issues
| What they write. | How we match. |
|---|---|
| https://blackwiki.org/index.php?title=Template:Linksto/doc#See_also {{ canonicalurl: Template:Linksto/doc#See also }} |
insource:"canonicalurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/
insource:"canonicalurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/ |
| [1] [https://blackwiki.org/index.php?title=Template:Linksto/doc#See_also] |
insource:"https fullurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/
insource:"fullurl {{{2}}} {{{1}}}" insource:/"#{{{1}}}]"/ |
| [2] [//en.wikipedia.org/wiki/template:linksto/doc#See_also] |
insource:"https https://blackwiki.org wiki {{{2}}} {{{1}}}" insource:/"#{{{1}}}"/ insource:"https https://blackwiki.org{{ localurl: {{{2}}} }} {{{1}}}" insource:/"#{{{1}}}"/ |
| https:https://blackwiki.org/index.php?title=Template:Linksto/doc#See_also https:{{SERVER}}{{localurl:template:linksto/doc}}#{{anchorencode:See also}} |
insource:"server localurl {{{2}}} anchorencode {{{1}}}" insource:/"#{{{1}}}]"/ insource:"https server localurl {{{2}}} anchorencode {{{1}}}" insource:/"#{{{1}}}"/ |
Regex pattern matching observations for the external-style links:
- Template:Sl for parameters in URL queries, not internal URL-styled links.
{{ Localurland{{ anchorencodeare used in tandem with SERVER.https:{{fullurlorhttps:{{SERVERcould be used instead of[{{fullurlor[{{SERVER{{ canonicalurldoes not need [brackets], but could have them [https://blackwiki.org/index.php?title=Template:Links_to/testcases{{ fullurlmust be[{{ fullurl]not[ {{ fullurl ]with spaces
Sandbox version
Via {{Section link}}: success means this page shows up in the search link.
- Template:Links to/doc#Purpose: Template:Plain link · Template:Plain link
- Template:Links to#Purposes: Template:Plain link · Template:Plain link
Via [[fullpagename#section name]]:
Success means that the search link highlights the match corresponds to the simulated section link.
The number signs (that make the ordered list) satisfy the regexp that simulates linksto mechanism.
- THis "has"/all the_issues Template:Links to#THis "has"/all the issues: Template:Plain link · Template:Plain link
- THis "has" all the issues Template:Links to#THis "has" all the issues: Template:Plain link · Template:Plain link
- THis has/all the issues Template:Links to#THis has/all the issues: Template:Plain link · Template:Plain link
- THis_has_all_the_issues Template:Links to#THis has all the issues: Template:Plain link · Template:Plain link
- THis has all the_issues Template:Links to#THis has all the issues: Template:Plain link · Template:Plain link
- THis has" all the issues Template:Links to#THis has" all the issues: Template:Plain link · Template:Plain link
- THis has/all/ the issues Template:Links to#THis has/all/ the issues: Template:Plain link · Template:Plain link
- Question "tick" marks? Template:Links to#Question "tick" marks?: Template:Plain link · Template:Plain link
- Question [../|sublinks]]? Template:Links to#Question [../|sublinks]]?: Template:Plain link · Template:Plain link
Main template
Linksto template has two parts:
- linksto part links to a fullpagename, in this case Template:Links to.
- regex part links to the following patterns (# char required).
Via {{Section link}}: success means this page shows up in the search link
- Template:Links to/doc#Purpose: Template:Plain link · Template:Plain link
- Template:Links to#Purposes: Template:Plain link · Template:Plain link
Via wikilink: The number signs (that make the ordered list) satisfy the regexp.
- THis "has"/all the_issues Template:Links to#THis "has"/all the issues: Template:Plain link · Template:Plain link
- THis "has" all the issues Template:Links to#THis "has" all the issues: Template:Plain link · Template:Plain link
- THis has/all the issues Template:Links to#THis has/all the issues: Template:Plain link · Template:Plain link
- THis_has_all_the_issues Template:Links to#THis has all the issues: Template:Plain link · Template:Plain link
- THis has all the_issues Template:Links to#THis has all the issues: Template:Plain link · Template:Plain link
- THis has" all the issues Template:Links to#THis has" all the issues: Template:Plain link · Template:Plain link
- THis has/all/ the issues Template:Links to#THis has/all/ the issues: Template:Plain link · Template:Plain link
- Question "tick" marks? Template:Links to#Question "tick" marks?: Template:Plain link · Template:Plain link
- Question [../|sublinks]]? Template:Links to#Question [../|sublinks]]?: Template:Plain link · Template:Plain link
Together the above link to the basepagename plus the pattern, simulate the success mechanism. Success means activating the search link and seeing corresponding, highlighted, pattern match.