Update dependencies to enable Greenkeeper 🌴 (#335)

adapt code to updated dependencies
This commit is contained in:
greenkeeper[bot] 2017-01-31 05:46:25 +00:00 committed by Estevão Soares dos Santos
parent 1832b7f721
commit b5e46fdb8d
34 changed files with 337 additions and 382 deletions

27
.eslintrc.json Normal file
View File

@ -0,0 +1,27 @@
{
"rules": {
"indent": [2, 2, {"SwitchCase": 1, "VariableDeclarator": 2}],
"curly": [2, "all"],
"operator-linebreak": [2, "after"],
"camelcase": [2, {"properties": "never"}],
"quotes": [2, "single"],
"no-multi-str": 2,
"no-mixed-spaces-and-tabs": 2,
"no-trailing-spaces": 2,
"space-unary-ops": [2,
{
"nonwords": false,
"overrides": {}
}
],
"brace-style": [2, "1tbs", {"allowSingleLine": true}],
"keyword-spacing": [2, {}],
"space-infix-ops": 2,
"space-before-blocks": [2, "always"],
"eol-last": 2,
"space-before-function-paren": [2, "always"],
"array-bracket-spacing": [2, "never", {"singleValue": false}],
"space-in-parens": [2, "never"],
"no-multiple-empty-lines": 2
}
}

3
.gitattributes vendored
View File

@ -3,12 +3,13 @@
.editorconfig export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.jscs.json export-ignore
.eslintrc.json export-ignore
.jshintignore export-ignore
.jshintrc
.travis.yml export-ignore
bower.json
Gruntfile.js export-ignore
performance.*
# Line endings control
CHANGELOG.md text

View File

@ -1,89 +0,0 @@
{
"validateIndentation": 2,
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireOperatorBeforeLineBreak": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"validateQuoteMarks": "'",
"disallowMultipleLineStrings": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"requireMultipleVarDecl": true,
"disallowKeywordsOnNewLine": ["else"],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBinaryOperators": [
"=",
"+=",
"-=",
"*=",
"/=",
"%=",
"<<=",
">>=",
">>>=",
"&=",
"|=",
"^=",
"+=",
"+",
"-",
"*",
"/",
"%",
"<<",
">>",
">>>",
"&",
"|",
"^",
"&&",
"||",
"===",
"==",
">=",
"<=",
"<",
">",
"!=",
"!=="
],
"requireSpaceAfterBinaryOperators": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInForStatement": true,
"requireLineFeedAtFileEnd": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true,
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInsideObjectBrackets": "all",
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideParentheses": true,
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
},
"disallowMultipleLineBreaks": true,
"disallowNewlineBeforeBlockStatements": true
}

View File

@ -13,6 +13,10 @@ cache:
directories:
- node_modules
# scripts
script:
- 'if [ "$TRAVIS_NODE_VERSION" == "0.12" ]; then echo "Bypassing EsLint" && grunt test-old; else echo "Running normal tests" && grunt test; fi'
# hooks
notifications:
webhooks:

View File

@ -73,17 +73,15 @@ module.exports = function (grunt) {
]
},
jscs: {
eslint: {
options: {
config: '.jscs.json'
config: '.eslintrc.json'
},
files: {
src: [
target: [
'Gruntfile.js',
'src/**/*.js',
'test/**/*.js'
]
}
},
conventionalChangelog: {
@ -171,7 +169,14 @@ module.exports = function (grunt) {
grunt.initConfig(config);
require('load-grunt-tasks')(grunt);
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-conventional-github-releaser');
grunt.loadNpmTasks('grunt-endline');
grunt.loadNpmTasks('grunt-simple-mocha');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('single-test', function (grep) {
'use strict';
@ -195,8 +200,14 @@ module.exports = function (grunt) {
perf.generateLogs();
});
grunt.registerTask('lint', ['jshint', 'jscs']);
grunt.registerTask('lint', function () {
'use strict';
grunt.loadNpmTasks('grunt-eslint');
grunt.task.run('jshint', 'eslint');
});
grunt.registerTask('test', ['clean', 'lint', 'concat:test', 'simplemocha:node', 'clean']);
grunt.registerTask('test-old', ['concat:test', 'simplemocha:node', 'clean']);
grunt.registerTask('performance', ['concat:test', 'performancejs', 'clean']);
grunt.registerTask('build', ['test', 'concat:dist', 'uglify', 'endline']);
grunt.registerTask('prep-release', ['build', 'conventionalChangelog']);

View File

@ -1,6 +1,6 @@
![Showdown][sd-logo]
[![Build Status](https://travis-ci.org/showdownjs/showdown.svg?branch=master)](https://travis-ci.org/showdownjs/showdown) [![npm version](https://badge.fury.io/js/showdown.svg)](http://badge.fury.io/js/showdown) [![Bower version](https://badge.fury.io/bo/showdown.svg)](http://badge.fury.io/bo/showdown) [![Join the chat at https://gitter.im/showdownjs/showdown](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/showdownjs/showdown.svg?branch=master)](https://travis-ci.org/showdownjs/showdown) [![npm version](https://badge.fury.io/js/showdown.svg)](http://badge.fury.io/js/showdown) [![Bower version](https://badge.fury.io/bo/showdown.svg)](http://badge.fury.io/bo/showdown) [![Join the chat at https://gitter.im/showdownjs/showdown](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/showdownjs/showdown?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Greenkeeper badge](https://badges.greenkeeper.io/showdownjs/showdown.svg)](https://greenkeeper.io/)
------

40
dist/showdown.js vendored
View File

@ -4,7 +4,7 @@
* Created by Tivie on 13-07-2015.
*/
function getDefaultOpts(simple) {
function getDefaultOpts (simple) {
'use strict';
var defaultOptions = {
@ -131,7 +131,7 @@ function getDefaultOpts(simple) {
return ret;
}
function allOptionsOn() {
function allOptionsOn () {
'use strict';
var options = getDefaultOpts(true),
ret = {};
@ -382,7 +382,7 @@ showdown.resetExtensions = function () {
* @param {string} name
* @returns {{valid: boolean, error: string}}
*/
function validate(extension, name) {
function validate (extension, name) {
'use strict';
var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
@ -469,7 +469,7 @@ function validate(extension, name) {
if (showdown.helper.isString(ext.regex)) {
ext.regex = new RegExp(ext.regex, 'g');
}
if (!ext.regex instanceof RegExp) {
if (!(ext.regex instanceof RegExp)) {
ret.valid = false;
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
return ret;
@ -603,7 +603,7 @@ showdown.helper.stdExtName = function (s) {
return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
};
function escapeCharactersCallback(wholeMatch, m1) {
function escapeCharactersCallback (wholeMatch, m1) {
'use strict';
var charCodeToEscape = m1.charCodeAt(0);
return '¨E' + charCodeToEscape + 'E';
@ -897,7 +897,7 @@ showdown.Converter = function (converterOptions) {
* Converter constructor
* @private
*/
function _constructor() {
function _constructor () {
converterOptions = converterOptions || {};
for (var gOpt in globalOptions) {
@ -929,7 +929,7 @@ showdown.Converter = function (converterOptions) {
* @param {string} [name='']
* @private
*/
function _parseExtension(ext, name) {
function _parseExtension (ext, name) {
name = name || null;
// If it's a string, the extension was previously loaded
@ -993,7 +993,7 @@ showdown.Converter = function (converterOptions) {
* @param {*} ext
* @param {string} name
*/
function legacyExtensionLoading(ext, name) {
function legacyExtensionLoading (ext, name) {
if (typeof ext === 'function') {
ext = ext(new showdown.Converter());
}
@ -1025,7 +1025,7 @@ showdown.Converter = function (converterOptions) {
* @param {string} name
* @param {function} callback
*/
function listen(name, callback) {
function listen (name, callback) {
if (!showdown.helper.isString(name)) {
throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
}
@ -1040,7 +1040,7 @@ showdown.Converter = function (converterOptions) {
listeners[name].push(callback);
}
function rTrimInputText(text) {
function rTrimInputText (text) {
var rsp = text.match(/^\s*/)[0].length,
rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
return text.replace(rgx, '');
@ -1388,7 +1388,7 @@ showdown.subParser('autoLinks', function (text, options, globals) {
text = text.replace(simpleMailRegex, replaceMail);
}
function replaceLink(wm, link, m2, m3, trailingPunctuation) {
function replaceLink (wm, link, m2, m3, trailingPunctuation) {
var lnkTxt = link,
append = '';
if (/^www\./i.test(link)) {
@ -1400,7 +1400,7 @@ showdown.subParser('autoLinks', function (text, options, globals) {
return '<a href="' + link + '">' + lnkTxt + '</a>' + append;
}
function replaceMail(wholeMatch, b, mail) {
function replaceMail (wholeMatch, b, mail) {
var href = 'mailto:';
b = b || '';
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);
@ -1945,7 +1945,7 @@ showdown.subParser('headers', function (text, options, globals) {
return showdown.subParser('hashBlock')(header, options, globals);
});
function headerId(m) {
function headerId (m) {
var title, escapedId;
if (ghHeaderId) {
@ -2261,7 +2261,7 @@ showdown.subParser('lists', function (text, options, globals) {
* @param {boolean} trimTrailing
* @returns {string}
*/
function parseConsecutiveLists(list, listType, trimTrailing) {
function parseConsecutiveLists (list, listType, trimTrailing) {
// check if we caught 2 or more consecutive lists by mistake
// we use the counterRgx, meaning if listType is UL we look for OL and vice versa
var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
@ -2270,7 +2270,7 @@ showdown.subParser('lists', function (text, options, globals) {
result = '';
if (list.search(counterRxg) !== -1) {
(function parseCL(txt) {
(function parseCL (txt) {
var pos = txt.search(counterRxg);
if (pos !== -1) {
// slice
@ -2419,7 +2419,7 @@ showdown.subParser('runExtension', function (ext, text, options, globals) {
} else if (ext.regex) {
// TODO remove this when old extension loading mechanism is deprecated
var re = ext.regex;
if (!re instanceof RegExp) {
if (!(re instanceof RegExp)) {
re = new RegExp(re, 'g');
}
text = text.replace(re, ext.replace);
@ -2530,7 +2530,7 @@ showdown.subParser('tables', function (text, options, globals) {
var tableRgx = /^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|¨0)/gm;
function parseStyles(sLine) {
function parseStyles (sLine) {
if (/^:[ \t]*--*$/.test(sLine)) {
return ' style="text-align:left;"';
} else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
@ -2542,7 +2542,7 @@ showdown.subParser('tables', function (text, options, globals) {
}
}
function parseHeaders(header, style) {
function parseHeaders (header, style) {
var id = '';
header = header.trim();
if (options.tableHeaderId) {
@ -2553,12 +2553,12 @@ showdown.subParser('tables', function (text, options, globals) {
return '<th' + id + style + '>' + header + '</th>\n';
}
function parseCells(cell, style) {
function parseCells (cell, style) {
var subText = showdown.subParser('spanGamut')(cell, options, globals);
return '<td' + style + '>' + subText + '</td>\n';
}
function buildTable(headers, cells) {
function buildTable (headers, cells) {
var tb = '<table>\n<thead>\n<tr>\n',
tblLgn = headers.length;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -40,24 +40,24 @@
},
"devDependencies": {
"chai": "^3.5.0",
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-concat": "^0.5.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-uglify": "^0.6.0",
"grunt-conventional-changelog": "^4.0.0",
"grunt-conventional-github-releaser": "^0.3.0",
"grunt-endline": "^0.4.0",
"grunt-jscs": "^1.2.0",
"grunt": "^1.0.1",
"grunt-contrib-clean": "^1.0.0",
"grunt-contrib-concat": "^1.0.1",
"grunt-contrib-jshint": "^1.1.0",
"grunt-contrib-uglify": "^2.0.0",
"grunt-conventional-changelog": "^6.1.0",
"grunt-conventional-github-releaser": "^1.0.0",
"grunt-endline": "^0.6.1",
"grunt-eslint": "^19.0.0",
"grunt-simple-mocha": "^0.4.0",
"js-beautify": "^1.5.6",
"load-grunt-tasks": "^3.2.0",
"performance-now": "^0.2.0",
"performance-now": "^2.0.0",
"quiet-grunt": "^0.2.3",
"semver": "^5.0.0",
"semver-sort": "0.0.4",
"sinon": "^1.14.1",
"source-map-support": "^0.2.9"
"source-map-support": "^0.4.11"
},
"dependencies": {
"yargs": "^6.6.0"

File diff suppressed because one or more lines are too long

View File

@ -6,40 +6,40 @@
### Test Suite: Basic (50 cycles)
| test | avgTime | max | min |
|:-----|--------:|----:|----:|
|Simple "Hello World"|0.366|6.060|0.165|
|performance.testfile.md|26.820|47.685|24.495|
|Simple "Hello World"|0.388|6.064|0.174|
|performance.testfile.md|26.899|49.063|24.845|
### Test Suite: subParsers (20 cycles)
| test | avgTime | max | min |
|:-----|--------:|----:|----:|
|hashHTMLBlocks|2.660|9.402|1.874|
|anchors|0.502|3.829|0.256|
|autoLinks|0.097|0.244|0.073|
|blockQuotes|3.239|6.987|2.821|
|codeBlocks|0.195|0.382|0.174|
|codeSpans|0.267|0.814|0.157|
|detab|0.102|0.176|0.087|
|encodeAmpsAndAngles|0.042|0.070|0.038|
|encodeBackslashEscapes|0.076|0.125|0.068|
|encodeCode|0.919|1.457|0.823|
|escapeSpecialCharsWithinTagAttributes|0.276|0.638|0.242|
|githubCodeBlocks|0.189|0.821|0.137|
|hashBlock|0.119|1.526|0.036|
|hashElement|0.002|0.032|0.000|
|hashHTMLSpans|0.341|1.617|0.238|
|hashPreCodeTags|0.139|0.299|0.109|
|headers|0.955|2.204|0.803|
|horizontalRule|0.216|0.331|0.194|
|images|0.081|0.165|0.073|
|italicsAndBold|0.254|0.438|0.210|
|lists|5.076|5.787|4.679|
|outdent|0.157|0.255|0.142|
|paragraphs|4.067|5.360|3.584|
|spanGamut|1.524|2.136|1.321|
|strikethrough|0.005|0.093|0.000|
|stripLinkDefinitions|0.160|0.229|0.143|
|tables|0.002|0.038|0.000|
|unescapeSpecialChars|0.009|0.050|0.006|
|hashHTMLBlocks|2.616|8.181|1.899|
|anchors|0.515|4.691|0.264|
|autoLinks|0.093|0.188|0.073|
|blockQuotes|4.518|8.953|3.036|
|codeBlocks|0.223|0.348|0.188|
|codeSpans|0.318|1.095|0.177|
|detab|0.092|0.137|0.087|
|encodeAmpsAndAngles|0.044|0.089|0.038|
|encodeBackslashEscapes|0.108|0.265|0.078|
|encodeCode|1.535|9.896|0.865|
|escapeSpecialCharsWithinTagAttributes|0.294|0.523|0.253|
|githubCodeBlocks|0.208|0.790|0.142|
|hashBlock|0.042|0.123|0.036|
|hashElement|0.002|0.029|0.000|
|hashHTMLSpans|0.410|1.598|0.240|
|hashPreCodeTags|0.132|0.395|0.110|
|headers|1.015|1.502|0.806|
|horizontalRule|0.220|0.357|0.195|
|images|0.158|0.978|0.077|
|italicsAndBold|0.288|0.639|0.241|
|lists|5.151|6.331|4.629|
|outdent|0.180|0.363|0.143|
|paragraphs|4.548|6.309|4.002|
|spanGamut|1.519|1.864|1.372|
|strikethrough|0.003|0.065|0.000|
|stripLinkDefinitions|0.179|0.313|0.144|
|tables|0.004|0.063|0.000|
|unescapeSpecialChars|0.011|0.049|0.007|
## [version 1.6.2](https://github.com/showdownjs/showdown/tree/1.6.2)

View File

@ -32,6 +32,7 @@ yargs
var argv = yargs.argv,
command = argv._[0];
if (command === 'makehtml') {
require('./makehtml.cmd.js').run();
} else {

View File

@ -72,7 +72,7 @@ for (var opt in showdownOptions) {
}
}
function run() {
function run () {
'use strict';
var argv = yargs.argv,
readMode = (!argv.i || argv.i === '') ? 'stdin' : 'file',
@ -120,7 +120,7 @@ function run() {
write(html, append);
messenger.okExit();
function parseOptions(flavor) {
function parseOptions (flavor) {
var options = {},
flavorOpts = showdown.getFlavorOptions(flavor) || {};
@ -156,7 +156,7 @@ function run() {
return options;
}
function readFromStdIn() {
function readFromStdIn () {
try {
var size = fs.fstatSync(process.stdin.fd).size;
return size > 0 ? fs.readSync(process.stdin.fd, size)[0] : '';
@ -166,7 +166,7 @@ function run() {
}
}
function readFromFile(encoding) {
function readFromFile (encoding) {
try {
return fs.readFileSync(argv.i, encoding);
} catch (err) {
@ -174,11 +174,11 @@ function run() {
}
}
function writeToStdOut(html) {
function writeToStdOut (html) {
return process.stdout.write(html);
}
function writeToFile(html, append) {
function writeToFile (html, append) {
// If a flag is passed, it means we should append instead of overwriting.
// Only works with files, obviously
var write = (append) ? fs.appendFileSync : fs.writeFileSync;

View File

@ -1,4 +1,4 @@
function Messenger(writeMode, supress, mute) {
function Messenger (writeMode, supress, mute) {
'use strict';
writeMode = writeMode || 'stderr';
supress = (!!supress || !!mute);

View File

@ -51,7 +51,7 @@ showdown.Converter = function (converterOptions) {
* Converter constructor
* @private
*/
function _constructor() {
function _constructor () {
converterOptions = converterOptions || {};
for (var gOpt in globalOptions) {
@ -83,7 +83,7 @@ showdown.Converter = function (converterOptions) {
* @param {string} [name='']
* @private
*/
function _parseExtension(ext, name) {
function _parseExtension (ext, name) {
name = name || null;
// If it's a string, the extension was previously loaded
@ -147,7 +147,7 @@ showdown.Converter = function (converterOptions) {
* @param {*} ext
* @param {string} name
*/
function legacyExtensionLoading(ext, name) {
function legacyExtensionLoading (ext, name) {
if (typeof ext === 'function') {
ext = ext(new showdown.Converter());
}
@ -179,7 +179,7 @@ showdown.Converter = function (converterOptions) {
* @param {string} name
* @param {function} callback
*/
function listen(name, callback) {
function listen (name, callback) {
if (!showdown.helper.isString(name)) {
throw Error('Invalid argument in converter.listen() method: name must be a string, but ' + typeof name + ' given');
}
@ -194,7 +194,7 @@ showdown.Converter = function (converterOptions) {
listeners[name].push(callback);
}
function rTrimInputText(text) {
function rTrimInputText (text) {
var rsp = text.match(/^\s*/)[0].length,
rgx = new RegExp('^\\s{0,' + rsp + '}', 'gm');
return text.replace(rgx, '');

View File

@ -101,7 +101,7 @@ showdown.helper.stdExtName = function (s) {
return s.replace(/[_?*+\/\\.^-]/g, '').replace(/\s/g, '').toLowerCase();
};
function escapeCharactersCallback(wholeMatch, m1) {
function escapeCharactersCallback (wholeMatch, m1) {
'use strict';
var charCodeToEscape = m1.charCodeAt(0);
return '¨E' + charCodeToEscape + 'E';

View File

@ -2,7 +2,7 @@
* Created by Tivie on 13-07-2015.
*/
function getDefaultOpts(simple) {
function getDefaultOpts (simple) {
'use strict';
var defaultOptions = {
@ -129,7 +129,7 @@ function getDefaultOpts(simple) {
return ret;
}
function allOptionsOn() {
function allOptionsOn () {
'use strict';
var options = getDefaultOpts(true),
ret = {};

View File

@ -237,7 +237,7 @@ showdown.resetExtensions = function () {
* @param {string} name
* @returns {{valid: boolean, error: string}}
*/
function validate(extension, name) {
function validate (extension, name) {
'use strict';
var errMsg = (name) ? 'Error in ' + name + ' extension->' : 'Error in unnamed extension',
@ -324,7 +324,7 @@ function validate(extension, name) {
if (showdown.helper.isString(ext.regex)) {
ext.regex = new RegExp(ext.regex, 'g');
}
if (!ext.regex instanceof RegExp) {
if (!(ext.regex instanceof RegExp)) {
ret.valid = false;
ret.error = baseMsg + '"regex" property must either be a string or a RegExp object, but ' + typeof ext.regex + ' given';
return ret;

View File

@ -23,7 +23,7 @@ showdown.subParser('autoLinks', function (text, options, globals) {
text = text.replace(simpleMailRegex, replaceMail);
}
function replaceLink(wm, link, m2, m3, trailingPunctuation) {
function replaceLink (wm, link, m2, m3, trailingPunctuation) {
var lnkTxt = link,
append = '';
if (/^www\./i.test(link)) {
@ -35,7 +35,7 @@ showdown.subParser('autoLinks', function (text, options, globals) {
return '<a href="' + link + '">' + lnkTxt + '</a>' + append;
}
function replaceMail(wholeMatch, b, mail) {
function replaceMail (wholeMatch, b, mail) {
var href = 'mailto:';
b = b || '';
mail = showdown.subParser('unescapeSpecialChars')(mail, options, globals);

View File

@ -52,7 +52,7 @@ showdown.subParser('headers', function (text, options, globals) {
return showdown.subParser('hashBlock')(header, options, globals);
});
function headerId(m) {
function headerId (m) {
var title, escapedId;
if (ghHeaderId) {

View File

@ -132,7 +132,7 @@ showdown.subParser('lists', function (text, options, globals) {
* @param {boolean} trimTrailing
* @returns {string}
*/
function parseConsecutiveLists(list, listType, trimTrailing) {
function parseConsecutiveLists (list, listType, trimTrailing) {
// check if we caught 2 or more consecutive lists by mistake
// we use the counterRgx, meaning if listType is UL we look for OL and vice versa
var olRgx = (options.disableForced4SpacesIndentedSublists) ? /^ ?\d+\.[ \t]/gm : /^ {0,3}\d+\.[ \t]/gm,
@ -141,7 +141,7 @@ showdown.subParser('lists', function (text, options, globals) {
result = '';
if (list.search(counterRxg) !== -1) {
(function parseCL(txt) {
(function parseCL (txt) {
var pos = txt.search(counterRxg);
if (pos !== -1) {
// slice

View File

@ -10,7 +10,7 @@ showdown.subParser('runExtension', function (ext, text, options, globals) {
} else if (ext.regex) {
// TODO remove this when old extension loading mechanism is deprecated
var re = ext.regex;
if (!re instanceof RegExp) {
if (!(re instanceof RegExp)) {
re = new RegExp(re, 'g');
}
text = text.replace(re, ext.replace);

View File

@ -7,7 +7,7 @@ showdown.subParser('tables', function (text, options, globals) {
var tableRgx = /^ {0,3}\|?.+\|.+\n[ \t]{0,3}\|?[ \t]*:?[ \t]*(?:-|=){2,}[ \t]*:?[ \t]*\|[ \t]*:?[ \t]*(?:-|=){2,}[\s\S]+?(?:\n\n|¨0)/gm;
function parseStyles(sLine) {
function parseStyles (sLine) {
if (/^:[ \t]*--*$/.test(sLine)) {
return ' style="text-align:left;"';
} else if (/^--*[ \t]*:[ \t]*$/.test(sLine)) {
@ -19,7 +19,7 @@ showdown.subParser('tables', function (text, options, globals) {
}
}
function parseHeaders(header, style) {
function parseHeaders (header, style) {
var id = '';
header = header.trim();
if (options.tableHeaderId) {
@ -30,12 +30,12 @@ showdown.subParser('tables', function (text, options, globals) {
return '<th' + id + style + '>' + header + '</th>\n';
}
function parseCells(cell, style) {
function parseCells (cell, style) {
var subText = showdown.subParser('spanGamut')(cell, options, globals);
return '<td' + style + '>' + subText + '</td>\n';
}
function buildTable(headers, cells) {
function buildTable (headers, cells) {
var tb = '<table>\n<thead>\n<tr>\n',
tblLgn = headers.length;

10
test/bootstrap.js vendored
View File

@ -19,20 +19,20 @@
};
*/
function getTestSuite(dir) {
function getTestSuite (dir) {
return fs.readdirSync(dir)
.filter(filter())
.map(map(dir));
}
function filter() {
function filter () {
return function (file) {
var ext = file.slice(-3);
return (ext === '.md');
};
}
function map(dir) {
function map (dir) {
return function (file) {
var name = file.replace('.md', ''),
htmlPath = dir + name + '.html',
@ -48,7 +48,7 @@
};
}
function assertion(testCase, converter) {
function assertion (testCase, converter) {
return function () {
testCase.actual = converter.makeHtml(testCase.input);
testCase = normalize(testCase);
@ -59,7 +59,7 @@
}
//Normalize input/output
function normalize(testCase) {
function normalize (testCase) {
// Normalize line returns
testCase.expected = testCase.expected.replace(/(\r\n)|\n|\r/g, '\n');

View File

@ -25,10 +25,10 @@ var globals = {
outputModifiers: [],
converter: converter,
ghCodeBlocks: []
},
},
options = showdown.getOptions();
function runTests() {
function runTests () {
var testMDFile = fs.readFileSync('test/performance.testfile.md', 'utf8');
new performance.Suite('Basic')
.setOption('cycles', 50)

View File

@ -43,7 +43,7 @@ describe('showdown.Converter', function () {
check(opt, ghOpts[opt]);
}
}
function check(key, val) {
function check (key, val) {
it('should set ' + opt + ' to ' + val, function () {
converter.getOption(key).should.equal(val);
});

View File

@ -11,6 +11,7 @@ describe('showdown.Converter', function () {
var showdown = require('../bootstrap').showdown;
describe('Converter.options extensions', function () {
var runCount;
showdown.extensions.testext = function () {
return [{
type: 'output',
@ -20,8 +21,8 @@ describe('showdown.Converter', function () {
}
}];
};
var runCount,
converter = new showdown.Converter({extensions: ['testext']});
var converter = new showdown.Converter({extensions: ['testext']});
it('output extensions should run once', function () {
runCount = 0;

View File

@ -39,8 +39,7 @@ performance.generateLog = function (filename, MDFilename, asTable) {
try {
jsonParsed = JSON.parse(json);
}
catch (err) {
} catch (err) {
jsonParsed = {};
}
@ -99,7 +98,7 @@ performance.generateLog = function (filename, MDFilename, asTable) {
generateMD(MDFilename, finalJsonObj, asTable);
};
function generateMD(filename, obj, asTable) {
function generateMD (filename, obj, asTable) {
fs.closeSync(fs.openSync(filename, 'w'));
asTable = !!asTable;