Last modified: 2007-05-13 01:05:56 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 8917 - Imagemap # comments prevent linking to sections
Imagemap # comments prevent linking to sections
Product: MediaWiki extensions
Classification: Unclassified
ImageMap (Other open bugs)
All All
: Normal normal with 3 votes (vote)
: ---
Assigned To: Nobody - You can work on this!
: 9885 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2007-02-08 01:14 UTC by Daniel Herding
Modified: 2007-05-13 01:05 UTC (History)
1 user (show)

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

quick and dirty fix for using # to link to a section in an article (1.34 KB, patch)
2007-04-16 19:53 UTC, Janåke Rönnblom

Description Daniel Herding 2007-02-08 01:14:47 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.
Comment 1 Anna Bauer 2007-04-16 16:14:06 UTC
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. 

Comment 2 Janåke Rönnblom 2007-04-16 19:53:49 UTC
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() ?
Comment 3 Raimond Spekking 2007-04-16 20:01:09 UTC
Fixed with r21299 by adding getFragmentForURL() 
Comment 4 Raimond Spekking 2007-04-16 20:21:59 UTC
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
Comment 5 Daniel Herding 2007-04-16 22:23:49 UTC
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
Comment 6 Raimond Spekking 2007-04-17 05:28:20 UTC
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.

Comment 7 Brion Vibber 2007-04-18 20:35:33 UTC
The fix looks kind of lame to me; IMHO the fix belongs upstream in

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.
Comment 8 Raimond Spekking 2007-04-19 07:26:56 UTC
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.
Comment 9 Brion Vibber 2007-04-24 20:36:53 UTC
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.
Comment 10 Aryeh Gregor (not reading bugmail, please e-mail directly) 2007-05-13 01:05:56 UTC
*** Bug 9885 has been marked as a duplicate of this bug. ***

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