Do something as what [[X (disambiguation)|]] does.
Version: unspecified
Severity: enhancement
liangent | |
Jan 2 2010, 5:22 AM |
F6110: linkpst.patch | |
Nov 21 2014, 10:50 PM |
Do something as what [[X (disambiguation)|]] does.
Version: unspecified
Severity: enhancement
Created attachment 6915
patch to add new core parser function {{linkpst:...}}
I'm not sure how this would be useful, but i made a patch which basically takes the link related stuff from Parser::pstPass2 and puts it in a core parser function named linkpst (since it essentially does the link related stuff of the pre-save-transform).
{{linkpst:foo (bar)}} -> foo
{{linkpst:ns:page}} -> page
{{linkpst:ns:bar (baz), fred|}} -> bar
etc.
The only thing i'm unsure about is the regex in $p4. It doesn't appear to match stuff during pst.
Attached:
Some thoughts for the patch in comment #2:
Perhaps another parameter indicating which steps are used?
{{linkpst:foo (bar)|B}} -> foo
{{linkpst:foo (bar)|C}} -> foo (bar)
{{linkpst:ns:page|N}} -> page
{{linkpst:ns:page}} -> page
{{linkpst:ns:page|N}} -> page
{{linkpst:ns:page|B}} -> ns:page
{{linkpst:ns:page|B}} -> ns:page
{{linkpst:ns:bar (baz), fred}} -> bar
{{linkpst:ns:bar (baz), fred|BC}} -> ns:bar
{{linkpst:ns:bar (baz), fred|NB}} -> bar, fred
{{linkpst:ns:bar (baz), fred|NC}} -> bar (baz)
{{linkpst:ns:bar (baz), fred|C}} -> ns:bar (baz)
(In reply to comment #2)
I'm not sure how this would be useful...
Neither am I.
(In reply to comment #3)
Maybe it's useful in some templates, to get the name of what an article
describes.
I'm not convinced. Can you explain yourself further?
For example a template {{disambig page}} with the content:
'''{{linkpst:{{PAGENAME}}}}''' may refer to:
{{{1}}}
{{disambig}}
If there's no linkpst, some pages may be displayed like:
'''ABC (disambiguation)''' may be refer to:
*something
*something else
{{disambig}}