Guest User

Untitled

a guest
Jun 22nd, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.36 KB | None | 0 0
  1. # Ambiguous
  2.  
  3. # Ambiguous
  4.  
  5. ## Ambiguous
  6.  
  7. # NFC Å - Å
  8.  
  9. # NFKC Äffin - Äffin
  10.  
  11. # NFD Å - Å
  12.  
  13. # NFKD Äffin - Äffin
  14.  
  15. # HTML character reference in header - abcd
  16.  
  17. # 123 starts with numerals
  18.  
  19. # Mixed case Roman numerals - Ⅰ Ⅱ Ⅲ Ⅳ ⅰ ⅱ ⅲ ⅳ
  20.  
  21. # Extra syntax # {#custom id}
  22.  
  23. # ASCII - !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
  24.  
  25. # Non-ASCII - ZWNJ=&#x200c; Punctuation=&#x2042;
  26.  
  27. # Lower ASCII - \_\!\_\"\_\#\_\$\_\%\_\&\_\'\_\(\_\)\_\*\_\+\_\,\_\-\_\.\_\/\_
  28.  
  29. # Tab_&#9;_
  30.  
  31. # Extra spaces
  32.  
  33. # -dashes-
  34.  
  35. -----
  36.  
  37. It looks like Github auto ids
  38.  
  39. - Proceed top to bottom and use `sprintf("%s-%d", id, n)` when `id` has been previously auto-assigned where `n` is the smallest integer >= 1 such that that expression has not been previously seen.
  40. - Codepoints < '0' are dropped except for spaces and `-`
  41. - Punctuation and non-graphical codepoints >= '0' are dropped.
  42. - Adjacent `-`s are not collapsed.
  43. - HTML character references are decoded and encoded letters are not replaced with `-`.
  44. - `{#...}` extension syntax is neither recognized nor exempted.
  45. - IDs may start with ASCII numerals.
  46. - Non-ASCII letters are not lower cased.
  47. - No Unicode normalization is done. See below.
  48.  
  49.  
  50. ```js
  51. // Run in dev console to see what the auto-id assigner does to Normalization examples from unicode.org.
  52. let ids = Array.from(document.querySelectorAll('*[id]')).map(x => x.id);
  53. let idToIdentityNormalForms = {};
  54. let normalForms = [ ['identity', x => x], ['NFC', x => x.normalize('NFC')], ['NFD', x => x.normalize('NFD')], ['NFKC', x => x.normalize('NFKC')], ['NFKD', x => x.normalize('NFKD')] ];
  55.  
  56. for (let id of ids) {
  57. let matches = [];
  58. for (let nf of normalForms) {
  59. if (nf[1](id) === id) { matches.push(nf[0]) }
  60. }
  61. idToIdentityNormalForms[id] = matches;
  62. }
  63. console.log(JSON.stringify(idToIdentityNormalForms, null, 2));
  64.  
  65. /*
  66. produces
  67. ...
  68. "user-content-nfc-Å---Å": [
  69. "identity"
  70. ],
  71. "user-content-nfkc-Äffin---Äffin": [
  72. "identity",
  73. "NFC"
  74. ],
  75. "user-content-nfd-Å---å": [
  76. "identity"
  77. ],
  78. "user-content-nfkd-Äffin---äffin": [
  79. "identity"
  80. ],
  81. ...
  82. */
  83. ```
Add Comment
Please, Sign In to add comment