Page MenuHomePhabricator

Copy-and-paste-friendly anchors for section headings
Closed, ResolvedPublic

Description

Author: gangleri

Description:
Dear friends,

You probably have written lots of lines where you refered to anchors with
characters others then A-Z, a-z, 0-9.

If used in sections the anchors *some characters* need to be specified with
".XX" values as ".2C" for "," etc. Normaly piped links should be used to have
readable result. If you are not shure which characters *must* be replaced you
need to make iterative tests.

enhancement request:
If a section contains characters which would generate ".XX" two anchors should
be generated

  1. the same as until now
  2. one which would "correspond" to simple "copy and paste" http://test.leuksman.com/index.php/Bugzilla_sections_and_anchors shows olso examples where <nowiki> ... </nowiki> *must* be added in this case but I consider this minor compared to ".XX" character conversion
  3. situations as \\ where the section differs from the title etc. should be

documented

Maybe T4346: Special characters break section links in page history
could be handeled by implementing this enhancement.

Impact on existing pages by the generation of *already existing* anchors:
I assume that very few pages would already have these "alternate" anchors.

Note: It is possible to simulate this with a template. Of course only if the
special characters are used in the section.

Regards Reinhardt [[user:gangleri]]


Version: unspecified
Severity: enhancement
URL: http://test.leuksman.com/index.php/Bugzilla_sections_and_anchors

Details

Reference
bz2381

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 8:30 PM
bzimport added a project: MediaWiki-Parser.
bzimport set Reference to bz2381.
bzimport added a subscriber: Unknown Object (MLST).

gangleri wrote:

bug 670: "special characters in anchor part of interwiki links not escaped
'correctly'"
relates to the roots of the problem - what should be achived

robchur wrote:

We have the {{anchorencode}} function to help convert anchors with multiple
special characters now.

If this is still a big problem for users, then adding a second, simpler form of
the anchor - perhaps a hash? - might be an option...we obviously don't want to
change the existing anchors and break user expectations and existing links.

ayg wrote:

I actually attempted to implement something like this ages ago back in my patch
for bug 5019. It would try to normalize characters with diacritics to
corresponding plain Latin characters where possible, for instance, and would
strip stuff like punctuation that couldn't be put in the anchor. Maybe I should
review that patch someday (although Tim doesn't like using wikitext to generate
the links and wants to continue using HTML). We can't do a simple
copy-and-paste operation, of course, because HTML id's can't contain many
characters.

Rob, adding total gibberish like a hash to anchors doesn't alleviate the problem
of hard-to-read total gibberish in anchors. :)

See also Bug 25107 - Enable section/paragraph hashes to be bookmarked.

See also Bug 16691 - Section headings should have some clickable anchor for passing links

matmarex subscribed.

The task description is a bit confusing to me, but I think this is asking for mostly the same thing as T75092: Anchors to section names for non-ASCII letters are encoded in the URL, and that one has been fixed (made possible by HTML5 allowing all characters in anchors, so we no longer have to encode them in silly ways).