Difference between revisions of "Template:Links to/testcases"
imported>Cpiral |
imported>Cpiral (→top: external links to test, and the regex notes to make the tests) |
||
| Line 22: | Line 22: | ||
#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 | ||
| − | |||
| − | + | {|class=wikitable | |
| − | + | |+ Patterns of external-style links to [[../doc#Purpose]]. | |
| − | + | ! For regexp template code, the unfolding text patterns | |
| − | + | ! Notes | |
| − | + | ||
| − | + | |- | |
| + | |{{canonicalurl:Template:Linksto/doc#Purpose}} (Works)<br/> | ||
| + | {<nowiki/>{canonicalurl:Template:Linksto/doc#Purpose}} | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | [{{fullurl:Template:linksto/doc#Purpose}}] (Works)<br/> | ||
| + | [{<nowiki/>{fullurl:Template:linksto/doc#Purpose}}] →<br/> | ||
| + | [{{fullurl:Template:linksto/doc#Purpose}}] | ||
| + | | | ||
| + | |||
| + | |- | ||
| + | | [{{fullurl:{{urlencode:Template:linksto/doc#Purpose}}}}] (Works)<br/> | ||
| + | [{<nowiki/>{fullurl:{<nowiki/>{urlencode:Template:linksto/doc#Purpose}}}}] →<br/> | ||
| + | [{{fullurl:{{urlencode:Template:linksto/doc#Purpose}}}}] | ||
| + | | urlencod could be placed elsewhere | ||
| + | |||
| + | |||
| + | |- | ||
| + | | [{{fullurl:{{anchorencode:Template:linksto/doc#Purpose}}}}] (Not!)<br/> | ||
| + | [{<nowiki/>{fullurl:{<nowiki/>{anchorencode:Template:linksto/doc#Purpose}}}}] →<br/> | ||
| + | [{{fullurl:{{anchorencode:Template:linksto/doc#Purpose}}}}] | ||
| + | | Does '''not''' link to a section<br/>Creates pagenames with # → .23 | ||
| + | |||
| + | |} | ||
| + | |||
| + | Regex pattern matching notes: | ||
| + | * urlencode can go in various places and still work | ||
| + | * localurl and anchorencode are not in question, they will not work with # | ||
| + | * fullurl:fullpagename|paramwith parameters is not in question: {{fullurl:fullpagename|huh}} | ||
| + | * canonical url does not need [brackets], but could have them | ||
| + | * fullurl must be [fullurl] not [ fullurl ] | ||
| + | * Match the template, or the hand-typed intermediate form. Both work, but both work with [Pp]agename the first letter. | ||
== [[Template:{{TEMPLATENAME|testcases}}/sandbox|Sandbox version]] == | == [[Template:{{TEMPLATENAME|testcases}}/sandbox|Sandbox version]] == | ||
Revision as of 23:52, 8 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|Purposes}} (for testing purposes:)
- Script error: No such module "Section link".
- Template:Links to/doc#Purpose (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
| For regexp template code, the unfolding text patterns | Notes |
|---|---|
| https://blackwiki.org/index.php?title=Template:Linksto/doc#Purpose (Works) {{canonicalurl:Template:Linksto/doc#Purpose}} |
|
| [1] (Works) [{{fullurl:Template:linksto/doc#Purpose}}] → |
|
| [2] (Works) [{{fullurl:{{urlencode:Template:linksto/doc#Purpose}}}}] → |
urlencod could be placed elsewhere
|
| [3] (Not!) [{{fullurl:{{anchorencode:Template:linksto/doc#Purpose}}}}] → |
Does not link to a section Creates pagenames with # → .23 |
Regex pattern matching notes:
- urlencode can go in various places and still work
- localurl and anchorencode are not in question, they will not work with #
- fullurl:fullpagename|paramwith parameters is not in question: https://blackwiki.org/index.php?title=Fullpagename&huh
- canonical url does not need [brackets], but could have them
- fullurl must be [fullurl] not [ fullurl ]
- Match the template, or the hand-typed intermediate form. Both work, but both work with [Pp]agename the first letter.
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.