Author: cyp
Description:
Request for enhancement: A parser function that can extract part of a wikilink
I imagine such a parser function would/could work something like this:
{{#linkpart: [[foo|bar]] }} => bar returns the link's presentation text
{{#linkpart: [[foo|bar]]:R }} => foo returns the "raw", i.e. the link's target
{{#linkpart: [[foo]] }} => foo presentation form and raw form are identical
{{#linkpart: [[foo]]:R }} => foo ... so both return the same thing
{{#linkpart: plaintext }} => plaintext // a non-link returns plain text
Rationale: Such a function is necessary for parameter handling in templates (e.g. to
deal with links when one isn't expected), and to be able to generate clean metadata. For example, invoking {{cite|title=[[foo|bar]] }} will be appear "fine" in an article, but the metadata (invisible to the editor) will end up with the wiki syntax too, as in:
<span title="ctx_ver=Z39.88-2004&rft.btitle=[[foo|bar]]"> (the urlencoded version thereof)
Version: unspecified
Severity: enhancement