|
|
@ -27,22 +27,17 @@ var SCOPED_ABBR = { |
|
|
|
'tm': '™' |
|
|
|
}; |
|
|
|
|
|
|
|
function replaceScopedAbbr(str) { |
|
|
|
if (str.indexOf('(') < 0) { return str; } |
|
|
|
|
|
|
|
return str.replace(SCOPED_ABBR_RE, function(match, name) { |
|
|
|
return SCOPED_ABBR[name.toLowerCase()]; |
|
|
|
}); |
|
|
|
function replaceFn(match, name) { |
|
|
|
return SCOPED_ABBR[name.toLowerCase()]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function replace_scoped(inlineTokens) { |
|
|
|
var i, token; |
|
|
|
|
|
|
|
for (i = inlineTokens.length - 1; i >= 0; i--) { |
|
|
|
token = inlineTokens[i]; |
|
|
|
if (token.type === 'text') { |
|
|
|
token.content = replaceScopedAbbr(token.content); |
|
|
|
token.content = token.content.replace(SCOPED_ABBR_RE, replaceFn); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|