Last modified: 2007-05-13 01:05:56 UTC
The imagemap extension allows adding links using the hash character (#). However, this hash character is required to create links to page sections. For example, [[de:Vorlage:Neutralität]] (the German NPOV template) has an image that should link to the #{{PAGENAME}} subsection of the NPOV page. This is impossible to realize using imagemaps. The solution is to remove the feature to add comments after a hash. From a usability point of view, it is a bad idea anyway. The usual way of adding comments is embedding them into <!-- HTML comments -->. It is confusing to have another comment syntax here.
Yes, it is inconvenient to change the way of adding comments. But it is not acceptable not to be able to do links to sections in articles.
Created attachment 3454 [details] quick and dirty fix for using # to link to a section in an article The # seems to be removed when you use escapeLocalURL() but not when you use escapeFullURL(). Bug or on purpose in escapeLocalURL() ?
Fixed with r21299 by adding getFragmentForURL()
Please note, that r21299 will fix links like [[Page#section]]. Links like [[Page#{{PAGENAME}}]] are still not possible, this is bug 2257: Template parameters unavailable to parser hooks
Instead of adding workarounds: What about my proposal to get rid of the # comment syntax altogether, to make the comment syntax more consistent and thus understandable?
This patch is not a workaround. It solves the problem with links to sections. Links like [[Page#{{PAGENAME}}]] are a complete different problem, nothing to do with any kind of comment style. Any line with '#' as _first_ character is filtered out at start of parsing the <imagemap> section.
The fix looks kind of lame to me; IMHO the fix belongs upstream in Title::getLocalURL(). Some other code would have to be modified to avoid double-fragments, though, and there might be some other issues, so it should be checked.
Title::getLocalURL()/escapeLocalURL is described explicitly with "Get a URL with no fragment or server name." We could use Title::getFullURL()/escapeFullURL instead: "Get an HTML-escaped version of the URL form, suitable for using in a link, including the server name and fragment" Should we? It works, have tested. Double-fragment seems to be no problem in both variants, the second # in a link will be urlencoded.
Yes but that makes no sense. Why the hell would we ever want the url *with* the path but *without* the fragment? The documentation was probably added after.
*** Bug 9885 has been marked as a duplicate of this bug. ***