diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 21:52:47 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 21:52:47 -0800 |
commit | d77b868584c988483fdb7892ccc5af09c6d99f1c (patch) | |
tree | a74d5d5a78e671f6a094906917912c0cd5e25364 /js/lib | |
parent | 0e8c3fc0f2878ad45023dc53d1fbbc53b82b94d2 (diff) |
JS linter improvements.
Diffstat (limited to 'js/lib')
-rw-r--r-- | js/lib/blocks.js | 3 | ||||
-rwxr-xr-x | js/lib/index.js | 2 | ||||
-rw-r--r-- | js/lib/inlines.js | 8 |
3 files changed, 5 insertions, 8 deletions
diff --git a/js/lib/blocks.js b/js/lib/blocks.js index f965fd7..2939afe 100644 --- a/js/lib/blocks.js +++ b/js/lib/blocks.js @@ -16,7 +16,7 @@ var isBlank = function(s) { // Convert tabs to spaces on each line using a 4-space tab stop. var detabLine = function(text) { "use strict"; - if (text.indexOf('\0') !== -1) { + if (text.indexOf('\u0000') !== -1) { // replace NUL for security text = text.replace(/\0/g, '\uFFFD'); } @@ -637,6 +637,7 @@ var processInlines = function(block) { }; var Document = function() { + "use strict"; var doc = new Node('Document', [[1, 1], [0, 0]]); doc.string_content = undefined; doc.strings = []; diff --git a/js/lib/index.js b/js/lib/index.js index 8b26946..d0532c6 100755 --- a/js/lib/index.js +++ b/js/lib/index.js @@ -14,7 +14,7 @@ var util = require('util'); var renderAST = function(tree) { - return util.inspect(tree.toAST(), {depth: 20}); + return util.inspect(tree.toAST(), {depth: 20}) + '\n'; }; module.exports.Node = require('./node'); diff --git a/js/lib/inlines.js b/js/lib/inlines.js index 405c6c9..0b40dfd 100644 --- a/js/lib/inlines.js +++ b/js/lib/inlines.js @@ -6,7 +6,6 @@ var entityToChar = require('./html5-entities.js').entityToChar; // Constants for character codes: var C_NEWLINE = 10; -var C_SPACE = 32; var C_ASTERISK = 42; var C_UNDERSCORE = 95; var C_BACKTICK = 96; @@ -62,18 +61,15 @@ var reLinkDestination = new RegExp( var reEscapable = new RegExp(ESCAPABLE); -var reAllEscapedChar = new RegExp('\\\\(' + ESCAPABLE + ')', 'g'); - var reEntityHere = new RegExp('^' + ENTITY, 'i'); -var reEntity = new RegExp(ENTITY, 'gi'); - var reEntityOrEscapedChar = new RegExp('\\\\' + ESCAPABLE + '|' + ENTITY, 'gi'); // Matches a string of non-special characters. var reMain = /^[^\n`\[\]\\!<&*_]+/m; var unescapeChar = function(s) { + "use strict"; if (s[0] === '\\') { return s[1]; } else { @@ -687,7 +683,7 @@ var parseNewline = function(block) { if (lastc && lastc.t === 'Text') { var sps = / *$/.exec(lastc.literal)[0].length; if (sps > 0) { - lastc.literal = lastc.literal.replace(/ *$/,''); + lastc.literal = lastc.literal.replace(/ *$/, ''); } block.appendChild(new Node(sps >= 2 ? 'Hardbreak' : 'Softbreak')); } else { |