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

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T23994, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 21994 - New magic word which strips disambiguation words (like during pst)
New magic word which strips disambiguation words (like during pst)
Status: RESOLVED DUPLICATE of bug 7264
Product: MediaWiki
Classification: Unclassified
Parser (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-01-02 05:22 UTC by Liangent
Modified: 2014-11-17 10:36 UTC (History)
4 users (show)

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


Attachments
patch to add new core parser function {{linkpst:...}} (2.96 KB, patch)
2010-01-02 07:48 UTC, Bawolff (Brian Wolff)
Details

Description Liangent 2010-01-02 05:22:22 UTC
Do something as what [[X (disambiguation)|]] does.
Comment 1 Liangent 2010-01-02 05:23:59 UTC
For example:

{{TRIM:X (disambiguation)}} -> X
{{TRIM:Y, Jr.}} -> Y
Comment 2 Bawolff (Brian Wolff) 2010-01-02 07:48:44 UTC
Created attachment 6915 [details]
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.
Comment 3 Liangent 2010-01-02 10:21:03 UTC
Maybe it's useful in some templates, to get the name of what an article describes.
Comment 4 Alexandre Emsenhuber [IAlex] 2010-01-02 13:56:55 UTC
Some thoughts for the patch in comment #2:
* do not use SFH_NO_HASH for new parser functions
* do not duplicate code, reuse the one in Parser.php if possible
* it would be very nice to have some test cases for that function in parser tests
Comment 5 Liangent 2010-01-02 14:04:16 UTC
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)
Comment 6 Chad H. 2010-01-02 22:43:25 UTC
(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?
Comment 7 Liangent 2010-01-03 05:14:55 UTC
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}}
Comment 8 Liangent 2010-01-03 05:15:48 UTC
Ignore that "be" in "'''ABC (disambiguation)''' may be refer to:" please. :)
Comment 9 Bawolff (Brian Wolff) 2010-02-07 02:41:45 UTC

*** This bug has been marked as a duplicate of bug 7264 ***

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


Navigation
Links