Last modified: 2014-11-17 10:36:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 7264 - Magic word to give Page Title as if pipe-trick performed on it
Magic word to give Page Title as if pipe-trick performed on it
Status: REOPENED
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Low enhancement with 8 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
:
: 7429 21994 25313 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-09-08 10:35 UTC by Phil Boswell
Modified: 2014-11-17 10:36 UTC (History)
9 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Phil Boswell 2006-09-08 10:35:46 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}}.
Comment 1 Rob Church 2006-12-09 10:58:14 UTC
*** Bug 7429 has been marked as a duplicate of this bug. ***
Comment 2 Andrew Garrett 2006-12-09 11:13:07 UTC
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}}}}.
Comment 3 Danny B. 2006-12-09 12:21:24 UTC
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
Comment 4 Conrad Irwin 2010-02-07 02:37:04 UTC
Added {{pipetrick:}} in r62077
Comment 5 Bawolff (Brian Wolff) 2010-02-07 02:41:45 UTC
*** Bug 21994 has been marked as a duplicate of this bug. ***
Comment 6 Danny B. 2010-02-07 03:26:52 UTC
{{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.).
Comment 7 Conrad Irwin 2010-02-08 01:43:56 UTC
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.
Comment 8 Danny B. 2010-02-08 13:25:52 UTC
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.
Comment 9 Conrad Irwin 2010-02-08 14:04:11 UTC
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.
Comment 10 Danny B. 2010-02-08 14:19:39 UTC
Such handling of parameters (:| combination) already exists and is being commonly used, see http://www.mediawiki.org/wiki/Help:Magic_words#Statistics
Comment 11 Conrad Irwin 2010-02-08 14:23:42 UTC
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}}.
Comment 12 Conrad Irwin 2010-02-08 14:26:56 UTC
Ach, I'm wrong. Some of them do...
Comment 13 Raimond Spekking 2010-02-19 11:48:04 UTC
Reverted by Tim in r62689. Work branched to http://www.mediawiki.org/w/index.php?title=Special:Code/MediaWiki/path&path=%2Fbranches%2Fconrad
Comment 14 Bawolff (Brian Wolff) 2010-09-25 23:53:18 UTC
*** Bug 25313 has been marked as a duplicate of this bug. ***
Comment 15 Chong-Dae Park 2013-04-04 10:15:08 UTC
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.
Comment 16 Morgon Kanter 2014-02-04 17:31:49 UTC
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

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links