diff --git a/bin/marked b/bin/marked index df4dcc0f..32ca3e0f 100755 --- a/bin/marked +++ b/bin/marked @@ -5,9 +5,9 @@ * Copyright (c) 2011-2013, Christopher Jeffrey (MIT License) */ -var fs = require('fs') - , util = require('util') - , marked = require('../'); +var fs = require('fs'), + path = require('path'), + marked = require('../'); /** * Man Page @@ -23,9 +23,9 @@ function help() { customFds: [0, 1, 2] }; - spawn('man', [__dirname + '/../man/marked.1'], options) - .on('error', function(err) { - fs.readFile(__dirname + '/../man/marked.1.txt', 'utf8', function(err, data) { + spawn('man', [path.resolve(__dirname, '/../man/marked.1')], options) + .on('error', function(err) { // eslint-disable-line handle-callback-err + fs.readFile(path.resolve(__dirname, '/../man/marked.1.txt'), 'utf8', function(err, data) { if (err) throw err; console.log(data); }); @@ -37,13 +37,13 @@ function help() { */ function main(argv, callback) { - var files = [] - , options = {} - , input - , output - , arg - , tokens - , opt; + var files = [], + options = {}, + input, + output, + arg, + tokens, + opt; function getarg() { var arg = argv.shift(); @@ -146,8 +146,8 @@ function main(argv, callback) { */ function getStdin(callback) { - var stdin = process.stdin - , buff = ''; + var stdin = process.stdin, + buff = ''; stdin.setEncoding('utf8'); diff --git a/test/browser/index.js b/test/browser/index.js index 8820a522..8208fa3f 100644 --- a/test/browser/index.js +++ b/test/browser/index.js @@ -33,7 +33,7 @@ app.get('/test.js', function(req, res, next) { res.send(testScript); }); -app.use(express.static(path.join(__dirname, '/../../lib'))) ; +app.use(express.static(path.join(__dirname, '/../../lib'))); app.use(express.static(__dirname)); app.listen(8080); diff --git a/test/browser/test.js b/test/browser/test.js index 54a37bc0..59917dd4 100644 --- a/test/browser/test.js +++ b/test/browser/test.js @@ -1,64 +1,66 @@ + ;(function() { + var console = {}, + files = __TESTS__; // eslint-disable-line no-undef -var console = {} - , files = __TESTS__; + console.log = function(text) { + var args = Array.prototype.slice.call(arguments, 1), + i = 0; -console.log = function(text) { - var args = Array.prototype.slice.call(arguments, 1) - , i = 0; + text = text.replace(/%\w/g, function() { + return args[i++] || ''; + }); - text = text.replace(/%\w/g, function() { - return args[i++] || ''; - }); + if (window.console) window.console.log(text); + document.body.innerHTML += '
' + escape(text) + ''; + }; - if (window.console) window.console.log(text); - document.body.innerHTML += '
' + escape(text) + ''; -}; + if (!Object.keys) { + Object.keys = function(obj) { + var out = [], + key; -if (!Object.keys) { - Object.keys = function(obj) { - var out = [] - , key; - - for (key in obj) { - if (Object.prototype.hasOwnProperty.call(obj, key)) { - out.push(key); + for (key in obj) { + if (Object.prototype.hasOwnProperty.call(obj, key)) { + out.push(key); + } } - } - return out; - }; -} + return out; + }; + } -if (!Array.prototype.forEach) { - Array.prototype.forEach = function(callback, context) { - for (var i = 0; i < this.length; i++) { - callback.call(context || null, this[i], i, obj); - } - }; -} + if (!Array.prototype.forEach) { + // eslint-disable-next-line no-extend-native + Array.prototype.forEach = function(callback, context) { + for (var i = 0; i < this.length; i++) { + callback.call(context || null, this[i], i, this); + } + }; + } -if (!String.prototype.trim) { - String.prototype.trim = function() { - return this.replace(/^\s+|\s+$/g, ''); - }; -} + if (!String.prototype.trim) { + // eslint-disable-next-line no-extend-native + String.prototype.trim = function() { + return this.replace(/^\s+|\s+$/g, ''); + }; + } -function load() { - return files; -} + // eslint-disable-next-line no-unused-vars + function load() { + return files; + } -function escape(html, encode) { - return html - .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') - .replace(//g, '>') - .replace(/"/g, '"') - .replace(/'/g, '''); -} + function escape(html, encode) { + return html + .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&') + .replace(//g, '>') + .replace(/"/g, '"') + .replace(/'/g, '''); + } -__LIBS__; - -(__MAIN__)(); + __LIBS__; // eslint-disable-line no-undef, no-unused-expressions + (__MAIN__)(); // eslint-disable-line no-undef }).call(this); diff --git a/test/integration/marked-spec.js b/test/integration/marked-spec.js index b312f8ee..c2c8955f 100644 --- a/test/integration/marked-spec.js +++ b/test/integration/marked-spec.js @@ -6,13 +6,12 @@ it('should run the test', function () { // http://spec.commonmark.org/0.28/#example-230 it('should start an ordered list at 0 when requested', function () { - expect( - marked('0. ok')). - toBe("
foo
\nbar\n
foo
\nbar\n