Skip to content
This repository has been archived by the owner on Aug 26, 2022. It is now read-only.

Bug 747403 -- refine section ID generation #283

Merged
merged 1 commit into from
Jun 19, 2012
Merged

Bug 747403 -- refine section ID generation #283

merged 1 commit into from
Jun 19, 2012

Conversation

ubernostrum
Copy link
Contributor

This is a first step, namely matching MindTouch behavior for sections
whose names contain non-ASCII characters. We now generate IDs in a
similar way: any section name which contains only ASCII content merely
has spaces replaced with underscores. A name which contains non-ASCII
characters has each such character replaced by hexadecimal digits
representing the appropriate UTF-8 codepoint(s), with each set of
digits preceded by a dot.

The test cases are a sampling of non-ASCII and mixed-character-set
section names and the slugs MindTouch generates for them.

This does not guarantee absolute parity with MindTouch, but probably
gets us close enough. It also does not deal with the problem of a
document in which not all section names are unique, but so far as I
can tell this does not introduce any new problems, merely perpeturts
an old one, assuming any such documents exist.

This is a first step, namely matching MindTouch behavior for sections
whose names contain non-ASCII characters. We now generate IDs in a
similar way: any section name which contains only ASCII content merely
has spaces replaced with underscores. A name which contains non-ASCII
characters has each such character replaced by hexadecimal digits
representing the appropriate UTF-8 codepoint(s), with each set of
digits preceded by a dot.

The test cases are a sampling of non-ASCII and mixed-character-set
section names and the slugs MindTouch generates for them.

This does not guarantee absolute parity with MindTouch, but probably
gets us close enough. It also does not deal with the problem of a
document in which not all section names are unique, but so far as I
can tell this does not introduce any new problems, merely perpeturts
an old one, assuming any such documents exist.
@lmorchard
Copy link
Contributor

Taking a peek.

@lmorchard
Copy link
Contributor

Tests pass, and the anchors match the handful of french locale pages I checked between my laptop Kuma and prod MindTouch. r+

lmorchard added a commit that referenced this pull request Jun 19, 2012
Bug 747403 -- refine section ID generation
@lmorchard lmorchard merged commit 4b3e865 into mdn:master Jun 19, 2012
stephaniehobson added a commit that referenced this pull request Oct 19, 2017
…mance-prefetch-preconnect

Fix issue #283, add dns-prefetch, preconnect for editor iframe
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants