Browse Source

Escape special chars

Right now, the copyright sign as well as other special char 
specifications like `(tm)`, `(r)` and `(p)` are not escapable.

This patch adds the ability to escape them, simply by checking for a `\` 
(Backslash) in front of the first bracket (`\(tm)` or `\(c)`).

Maybe not the best way, but works 🤞
pull/501/head
Sheogorath 6 years ago
parent
commit
065378d6a8
No known key found for this signature in database GPG Key ID: 1F05CC3635CDDFFD
  1. 4
      lib/rules_core/replacements.js

4
lib/rules_core/replacements.js

@ -19,9 +19,9 @@ 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_TEST_RE = /(?:^\((c|tm|r|p)\)|[^\\]\((c|tm|r|p)\))/i;
var SCOPED_ABBR_RE = /\((c|tm|r|p)\)/ig;
var SCOPED_ABBR_RE = /(?:^\((c|tm|r|p)\)|[^\\]\((c|tm|r|p)\))/ig;
var SCOPED_ABBR = {
c: '©',
r: '®',

Loading…
Cancel
Save