diff --git a/lib/rules_core/replacements.js b/lib/rules_core/replacements.js index 4022df3..b5e2f64 100644 --- a/lib/rules_core/replacements.js +++ b/lib/rules_core/replacements.js @@ -19,6 +19,10 @@ var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/; +// Workaround for phantomjs - need regex without /g flag, +// or root check will fail every second time +var SCOPED_ABBR_TEST_RE = /\((c|tm|r|p)\)/i; + var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig; var SCOPED_ABBR = { 'c': '©', @@ -75,7 +79,7 @@ module.exports = function replace(state) { if (state.tokens[blkIdx].type !== 'inline') { continue; } - if (SCOPED_ABBR_RE.test(state.tokens[blkIdx].content)) { + if (SCOPED_ABBR_TEST_RE.test(state.tokens[blkIdx].content)) { replace_scoped(state.tokens[blkIdx].children); }