Last modified: 2011-04-30 01:21:00 UTC
{{localurl:User:Bob#section}} discards the '#section' part in building the local URL. That seems inconsistent with {{fullurl:User:Bob#section}} which keeps it.
#section is known as a fragment. Title::getLocalURL() does not return the fragment. To get it, one should use Title::getLinkUrl(). Committed in trunk as r73976
(In reply to comment #1) > #section is known as a fragment. > Title::getLocalURL() does not return the fragment. To get it, one should use > Title::getLinkUrl(). > > Committed in trunk as r73976 You added a new magic word instead of fixing the current one? I don't understand.
Neither do I :P
Re-opening this for now.
To me getLocalURL() and getLinkUrl() are two different functions and deserve differents magic word.
But what's the usecase for having a magic word which strips the fragment?
Since Title has two functions, I though we could have two magic words as well. One possibility was to map {{localurl:}} with Title::getLinkUrl() instead of Title::getLocalURL(), but that looks weird and inconsistent.
(In reply to comment #7) > Since Title has two functions, I though we could have two magic words as well. > > One possibility was to map {{localurl:}} with Title::getLinkUrl() instead of > Title::getLocalURL(), but that looks weird and inconsistent. I think you should re-read the opening post. :-) "{{localurl:User:Bob#section}}" returns "/wiki/User:Bob". This is wrong. This is the bug. Instead, "{{localurl:User:Bob#section}}" should return "/wiki/User:Bob#section", just like {{fullurl:}} does currently. (And "{{localurl:User:Bob#section|action=edit}}" should return "/w/index.php?title=User:Bob&action=edit#section".) I can't see any reason {{localurl:}} would intentionally strip the section anchor. If there are use-cases for other magic words, I think they should be the topic of other bugs. This one is about {{localurl:}} stripping the section anchor needlessly and unexpectedly.
patch r73976 reverted with r75250