Last modified: 2009-01-31 23:11:05 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 8249 - Parser functions to obtain talk page, namespace, talk namespace, basename, etc. for named targets
Parser functions to obtain talk page, namespace, talk namespace, basename, et...
Status: RESOLVED FIXED
Product: MediaWiki extensions
Classification: Unclassified
ParserFunctions (Other open bugs)
unspecified
All All
: Normal enhancement with 2 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch
: 17287 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-12-13 18:55 UTC by darklama
Modified: 2009-01-31 23:11 UTC (History)
4 users (show)

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


Attachments
Reimplementation of the builtin variables as a parserfunction library (9.50 KB, patch)
2006-12-13 23:28 UTC, Carl Fürstenberg
Details
Adaptation if namespace functions in ParserFunctions (3.16 KB, patch)
2007-09-14 14:03 UTC, Carl Fürstenberg
Details
Patch adding core parser function versions of the various variables (7.55 KB, patch)
2008-12-21 20:32 UTC, Brad Jorsch
Details
Proposed patch v1 (4.27 KB, patch)
2009-01-31 21:20 UTC, rememberthedot
Details

Description darklama 2006-12-13 18:55:33 UTC
Now that there is a method of conveting relative paths to absolute paths, it
would be nice if as an enhancements to this function could be made to allow
named paths in addition to using a relative path name in order to get a absolute
path name. 

Some examples:

{{#rel2abs:Talk|Help:ParserFunction}}, will result in Help_talk:ParserFunction
{{#rel2abs:Namespace|Help:ParserFunction}}, will result in Help
{{#rel2abs:Talkspace|Help:ParserFunction}}, will result in Help_talk
{{#rel2abs:Basename|Help:Very/Deep/Path/What/Can/We/Do}}, will result in Help:Very
Comment 1 Rob Church 2006-12-13 19:03:33 UTC
If implemented, these should either be separate parser functions, or else a new
base function; it isn't appropriate to extend rel2abs to perform these tasks.
Comment 2 darklama 2006-12-13 20:13:37 UTC
I figure this is fits in with what rel2abs does. Talk pages and Namespaces are
relative to the base path given, resulting in an absolute path. Basename fits in
as shorthand for how ever many ../ are needed to get to the top level of the
tree. None of the pages would need to exist nor any check to make sure its a
valid talk page or namespace prefix.
Comment 3 Carl Fürstenberg 2006-12-13 23:28:42 UTC
Created attachment 2860 [details]
Reimplementation of the builtin variables as a parserfunction library

as rel2abs already have two parameters, it would be difficult to change it's
behavior, so I though the best way was to re-implement the built in variables
to be able to check on a given path instead of current title.
Comment 4 darklama 2006-12-14 21:12:44 UTC
Looks good Carl, from looking at the attachment it seems to do what I was
talking about. I just noticed possibly one subtile bug, in which basepagenamee
seems to be returning the same value as basepagename.
Comment 5 darklama 2007-08-07 15:23:10 UTC
The introduction of the {{#titleparts}} ParserFunction provides a solution for obtaining only part of the title, which was partially what I was hoping to have addressed by this proposal. If someone could add a complementary parser function to the ParserFunction extension, to obtain the namespace part, something like:

{{#namespacepart:Help:ParserFunctions}} = Help

then I believe this bug could be closed as fixed.
Comment 6 Carl Fürstenberg 2007-09-14 14:03:24 UTC
Created attachment 4110 [details]
Adaptation if namespace functions in ParserFunctions

Similar to the previous patch, but only things made for the namespace part of the title
Comment 7 Happy-melon 2008-12-21 18:09:35 UTC
This should be implemented by allowing these variables to take one parameter, the full title to evaluate on.  The current implementation then becomes the 'fallback' case where there is no such value, a natural default.  So {{FULLPAGENAME:Foo}} would be transparent, and {{NAMESPACE:Help:Foo}} == Help. 
Comment 8 Brad Jorsch 2008-12-21 20:32:51 UTC
Created attachment 5606 [details]
Patch adding core parser function versions of the various variables

I couldn't get attachment 2860 [details] to work because I was forgetting to set $wgPathFunctionsUseNoPrefixHash=true, so I made this patch. It adds the functions to CoreParserFunctions.php (alongside {{ns:}}), instead of adding them as a separate extension. Other differences include:
* Some calls to wfEscapeWikiText()
* Correct behavior when targeting [[0]]
* Correct escaping on BASEPAGENAMEE
* No debugging code in NAMESPACE
* Behavior when getting the talk page for a namespace where $title->canTalk() returns false.

I've long wished for something like what either of these patches provides.
Comment 9 Alex Z. 2009-01-31 01:46:21 UTC
Functions for namespaces added in r46630.
Comment 10 Alex Z. 2009-01-31 19:35:52 UTC
*** Bug 17287 has been marked as a duplicate of this bug. ***
Comment 11 rememberthedot 2009-01-31 21:20:07 UTC
Created attachment 5759 [details]
Proposed patch v1

New patch against current tree that adds FULLPAGENAME, PAGENAME, BASEPAGENAME, SUBPAGENAME, SUBJECTPAGENAME, and TALKPAGENAME.
Comment 12 Alex Z. 2009-01-31 22:25:22 UTC
*PAGENAME functions added in r46662
Comment 13 rememberthedot 2009-01-31 23:11:05 UTC
Thank you!

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


Navigation
Links