Last modified: 2014-11-17 10:36:13 UTC
I would like a magic word which worked like {{PAGENAME}} but as if the pipe-trick had been performed on it. So whereas in [[John Doe (actor)]] {{PAGENAME}} would give "John Doe (actor)", I want simply "John Doe". This would be most useful in templates like {{imdb name}} where the result is for display not for linking. Possible nomenclature: {{PAGENAMEP}} together with {{PAGENAMEEP}} or {{PAGENAMEPE}}.
*** Bug 7429 has been marked as a duplicate of this bug. ***
hmmm.. I don't like PAGENAMEP - but I DO like the idea. Actually, it'd be better off as a function that went something like this: {{PIPETRICK|{{PAGENAME}}}}.
Rewritten from bug 7429: I'd rather suggest this forms of magic words: {{DISAMBIGPAGENAME}} Project:Foo (bar) -> Project:Foo Project talk:Foo (bar) -> Project talk:Foo {{DISAMBIGARTICLEPAGENAME}} Project talk:Foo (bar) -> Project:Foo {{DISAMBIGTALKPAGENAME}} Project:Foo (bar) -> Project talk:Foo
Added {{pipetrick:}} in r62077
*** Bug 21994 has been marked as a duplicate of this bug. ***
{{pipetrick:}} is definitely nice, however it should be accompanied by the complement set of variables to random {{..PAGENAME(E)}} variables (see [[mw:Help:Magic words#Page_names]]), so one wouldn't have to create ugly templates with content like {{TALKPAGENAME:{{NAMESPACE}}:{{pipetrick: {{{title|{{PAGENAME}}}}}}}}} (to get {{TALKPAGENAMEP}}), which are indeed much more expensive than single variable which returns the same. Alternative (maybe even better) may be adding of |P ({{TALKPAGENAME|P}} etc.).
I've had second thoughts about changing this to #pipetrick; would it not be better to have {{PIPETRICK}} similar to {{PAGENAME}} when on it's own, and then we could couple that with {{PIPETRICKE}} (maybe this would even prompt a better choice of name :D). This would allow the features here to be implemented as: {{DISAMBIGPAGENAME}} = {{PIPETRICK}} {{DISAMBIGSUBPAGENAME}} = {{PIPETRICK}} (per recent changes) {{DISAMBIGBASEPAGENAME}} = {{PIPETRICK:{{BASEPAGENAME}}}} {{DISAMBIGFULLPAGENAME}} = {{NAMESPACE}}:{{PIPETRICK}} {{DISAMBIGTALKPAGENAME}} = {{TALKSPACE}}:{{PIPETRICK}} {{DISAMBIGSUBJECTPAGENAME}} = {{SUBJECTSPACE}}:{{PIPETRICK}} Which I think is a little cleaner than adding an extra 12 variables and magic words.
As suggested in comment 6, you don't have to add the whole new set, just a modificator after pipe char to current set, as we did it to random other variables through the time. I would consider that as optimal - since the clearest and simpliest - solution actually.
These variables already take an argument which is the page name to act on. {{PAGENAME:Talk:Hi}} => Hi. It would not be hard to modify them so that {{PAGENAME:|P}} works as you propose; but {{PAGENAME|P}} would require changes to the parser (or you could just implement Template:PAGENAME {{#ifeq:{{{1|}}}|P|{{PIPETRICK}}|{{PAGENAME}}}}). Implementation of the above 6 (really 12 with the {{PAGENAMEE:|P}} versions) cases is just a case of translating that wikitext into PHP. The reason I WONTFIX this is because I think this syntax is ugly and confusing {{PAGENAME}} {{PAGENAMEE}} {{PAGENAME:|P}} {{PAGENAMEE:|P}} provides two totally different syntaxes for providing behavioural flags (right, we could change it to be {{PAGENAME:|E|P}} or {{PAGENAME:|EP}} or :|PE or :|P|E to make it consistent). The :| is still clearly a nasty hack, and I think people would be bitten by {{PAGENAME:P}} more often than not.
Such handling of parameters (:| combination) already exists and is being commonly used, see http://www.mediawiki.org/wiki/Help:Magic_words#Statistics
They don't implicitly assume that :| == :{{PAGENAME}}| You could do {{FULLPAGENAME:{{PAGENAME}}|P}} - I have no problem with that, but it's longer and yuckier than {{NAMESPACE}}:{{PAGENAME}}.
Ach, I'm wrong. Some of them do...
Reverted by Tim in r62689. Work branched to http://www.mediawiki.org/w/index.php?title=Special:Code/MediaWiki/path&path=%2Fbranches%2Fconrad
*** Bug 25313 has been marked as a duplicate of this bug. ***
This could be useful for templates. For example, Template:PipedLink could be work as: * {{PipedLink|Boston}} will produce "[[Boston]]". * {{PipedLink|San Jose, California}} will produce "[[San Jose, California|San Jose]]" * {{PipedLink|Georgia (U.S. state)}} will produce "[[Georgia (U.S. state)|Georgia]]". If [[{{#pipetrick:{{{1}}} }}]] works, it will reduce headache when designing templates. Instead of {{BlahBlah... | state = [[Georgia (U.S. state)|Georgia]] }} or {{BlahBlah2... | state = Georgia | state_link = Georgia (U.S. state) }} , we can put simply as {{BlahBlah2... | state = Georgia (U.S. state) }} Now we can make this function via Lua module. But this function should be supported by MediaWiki core.
FYI for anyone that needs functionality like this, we implemented it on our wiki using plain old ParserFunctions. It's REALLY ugly and almost impossible to maintain or extend, but it works. http://dnd-wiki.org/wiki/Template:Pipe_Trick