|
|
@ -241,10 +241,28 @@ function isMdAsciiPunct(ch) { |
|
|
// Hepler to unify [reference labels].
|
|
|
// Hepler to unify [reference labels].
|
|
|
//
|
|
|
//
|
|
|
function normalizeReference(str) { |
|
|
function normalizeReference(str) { |
|
|
// use .toUpperCase() instead of .toLowerCase()
|
|
|
// Trim and collapse whitespace
|
|
|
// here to avoid a conflict with Object.prototype
|
|
|
//
|
|
|
// members (most notably, `__proto__`)
|
|
|
str = str.trim().replace(/\s+/g, ' '); |
|
|
return str.trim().replace(/\s+/g, ' ').toUpperCase(); |
|
|
|
|
|
|
|
|
// In node v10 'ẞ'.toLowerCase() === 'Ṿ', which is presumed to be a bug
|
|
|
|
|
|
// fixed in v12 (couldn't find any details).
|
|
|
|
|
|
//
|
|
|
|
|
|
// So treat this one as a special case
|
|
|
|
|
|
// (remove this when node v10 is no longer supported).
|
|
|
|
|
|
//
|
|
|
|
|
|
if ('ẞ'.toLowerCase() === 'Ṿ') { |
|
|
|
|
|
str = str.replace(/ẞ/g, 'ß'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// .toLowerCase().toUpperCase() should get rid of all differences
|
|
|
|
|
|
// between letter variants.
|
|
|
|
|
|
//
|
|
|
|
|
|
// Final result should be uppercased, because it's later stored in an object
|
|
|
|
|
|
// (this avoid a conflict with Object.prototype members,
|
|
|
|
|
|
// most notably, `__proto__`)
|
|
|
|
|
|
//
|
|
|
|
|
|
return str.toLowerCase().toUpperCase(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|