diff options
author | Sindre Sorhus <sindresorhus@gmail.com> | 2015-04-08 18:24:26 +0700 |
---|---|---|
committer | Sindre Sorhus <sindresorhus@gmail.com> | 2015-04-08 18:24:26 +0700 |
commit | 6b56c7de7f664454ff16eb2a8ad0790c022e5a74 (patch) | |
tree | bbb8573c5712da37c4f683b037daa4e2a3fc2786 /lib/template.js | |
parent | 334f782aa80599f4885b531548ad8661fd475ebb (diff) | |
download | gitbook-6b56c7de7f664454ff16eb2a8ad0790c022e5a74.zip gitbook-6b56c7de7f664454ff16eb2a8ad0790c022e5a74.tar.gz gitbook-6b56c7de7f664454ff16eb2a8ad0790c022e5a74.tar.bz2 |
use the `escape-string-regexp` module
no point in hardcoding this.
https://github.com/sindresorhus/escape-string-regexp
Diffstat (limited to 'lib/template.js')
-rw-r--r-- | lib/template.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/template.js b/lib/template.js index 187df87..3e6364d 100644 --- a/lib/template.js +++ b/lib/template.js @@ -2,9 +2,9 @@ var _ = require("lodash"); var Q = require("q"); var path = require("path"); var nunjucks = require("nunjucks"); +var escapeStringRegexp = require("escape-string-regexp"); var git = require("./utils/git"); -var stringUtils = require("./utils/string"); var fs = require("./utils/fs"); var batch = require("./utils/batch"); var pkg = require("../package.json"); @@ -302,7 +302,7 @@ TemplateEngine.prototype.addBlock = function(name, block) { TemplateEngine.prototype._applyShortcut = function(parser, content, shortcut) { if (!_.contains(shortcut.parsers, parser)) return content; var regex = new RegExp( - stringUtils.escapeRegex(shortcut.start) + "([\\s\\S]*?[^\\$])" + stringUtils.escapeRegex(shortcut.end), + escapeStringRegexp(shortcut.start) + "([\\s\\S]*?[^\\$])" + escapeStringRegexp(shortcut.end), 'g' ); return content.replace(regex, function(all, match) { |