Difference between revisions of "Template:Pipe Trick"
m |
(rollback to version that doesn't use generic template. had an interesting artifact that would only show a link if it was red; otherwise it wouldn't link at all.) |
||
Line 1: | Line 1: | ||
− | <includeonly>[[{{{1}}}|{{ | + | <includeonly>{{#if: {{#pos:{{{1}}}|(}} | [[{{{1}}}{{!}}{{#sub:{{#if: {{#pos:{{{1}}}|:}} | {{#sub:{{{1}}}|{{#expr: {{#pos:{{{1}}}|:}} + 1}} }} | {{{1}}} }}|0|{{#expr:{{#pos:{{#if: {{#pos:{{{1}}}|:}} | {{#sub:{{{1}}}|{{#expr: {{#pos:{{{1}}}|:}} + 1}} }} | {{{1}}} }}|(}} - 1 }}}}{{#sub:{{{1}}}|{{#expr: {{#pos:{{{1}}}|)}}+1}}}}]] | [[{{{1}}}{{!}}{{#if: {{#pos:{{{1}}}|:}} | {{#sub:{{{1}}}|{{#expr: {{#pos:{{{1}}}|:}} + 1}} }} | {{{1}}} }}]]}}</includeonly><noinclude>{{documentation}}</noinclude> |
Revision as of 04:10, 30 August 2016
This template creates a link from text and acts like the pipe trick in ordinary links. For example, [[Some Feat (3.5e Feat)|]] will be turned into [[Some Feat (3.5e Feat)|Some Feat]] when the page is saved.
This template emulates that, for the purposes of DPL and ask queries. It will remove parenthesis at the end of a link, as well as namespaces at the front of a link. To use this template, just do {{Pipe Trick|Page (text)}}, and make sure that the template argument is not itself a link. The template will resolve to [[Page (text)|Page]].
This provides a workaround for how Semantic MediaWiki, when outputting links, will always output the suffix our wiki adds like (3.5e Class). Usually when displaying links, you don't want that -- so you can use this template to get around it. Your queries should include the template parameter, and use this template, along with "link=none". For example, for a comma-separated list of links without the suffix, you'd write:
{{#ask: [[Category:3.5e]] [[Category:Class]] [[Category:Base Class]] |format=list |template=Pipe Trick |link=none }}
Note that this will just remove the portion of the page title in parentheses, and will otherwise output full subpage names.