|
|
@ -85,21 +85,25 @@ function replace_rare(inlineTokens) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = function replace(state) { |
|
|
|
var blkIdx; |
|
|
|
var typographerOption = state.md.options.typographer; |
|
|
|
|
|
|
|
if (!typographerOption) { return; } |
|
|
|
|
|
|
|
if (!state.md.options.typographer) { return; } |
|
|
|
var optionIsObject = typeof typographerOption === 'object'; |
|
|
|
var replaceRare = !optionIsObject || typographerOption.rare; |
|
|
|
var replaceIP = !optionIsObject || typographerOption.intellectualProperty; |
|
|
|
|
|
|
|
for (blkIdx = state.tokens.length - 1; blkIdx >= 0; blkIdx--) { |
|
|
|
|
|
|
|
if (state.tokens[blkIdx].type !== 'inline') { continue; } |
|
|
|
|
|
|
|
if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) { |
|
|
|
if (replaceIP && SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) { |
|
|
|
replace_scoped(state.tokens[blkIdx].children); |
|
|
|
} |
|
|
|
|
|
|
|
if (RARE_RE.test(state.tokens[blkIdx].content)) { |
|
|
|
if (replaceRare && RARE_RE.test(state.tokens[blkIdx].content)) { |
|
|
|
replace_rare(state.tokens[blkIdx].children); |
|
|
|
} |
|
|
|
|
|
|
|