Browse Source

Regex workagound for phantomjs, related to #77

pull/82/head
Vitaly Puzrin 10 years ago
parent
commit
cc87145842
  1. 6
      lib/rules_core/replacements.js

6
lib/rules_core/replacements.js

@ -19,6 +19,10 @@
var RARE_RE = /\+-|\.\.|\?\?\?\?|!!!!|,,|--/; 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_RE = /\((c|tm|r|p)\)/ig;
var SCOPED_ABBR = { var SCOPED_ABBR = {
'c': '©', 'c': '©',
@ -75,7 +79,7 @@ module.exports = function replace(state) {
if (state.tokens[blkIdx].type !== 'inline') { continue; } 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); replace_scoped(state.tokens[blkIdx].children);
} }

Loading…
Cancel
Save