showdown-table
Advanced tools
Comparing version
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/showdownjs/table-extension", | ||
"license": "BSD", | ||
"license": "BSD-2-Clause", | ||
"authors": [ | ||
@@ -25,2 +25,5 @@ "Estevão Santos (https://github.com/tivie)", | ||
"main": ["dist/showdown-table.js"], | ||
"dependencies": { | ||
"showdown": "1.0.x" | ||
}, | ||
"ignore": [ | ||
@@ -27,0 +30,0 @@ "src/", |
@@ -1,2 +0,2 @@ | ||
/*! showdown-table 24-01-2015 */ | ||
/*! showdown-table 17-06-2015 */ | ||
/* | ||
@@ -17,2 +17,3 @@ * Basic table support with re-entrant parsing, where cell content | ||
(function () { | ||
'use strict'; | ||
@@ -23,4 +24,4 @@ var table = function (converter) { | ||
tables.th = function (header) { | ||
if (header.trim() === "") { | ||
return ""; | ||
if (header.trim() === '') { | ||
return ''; | ||
} | ||
@@ -34,3 +35,5 @@ var id = header.trim().replace(/ /g, '_').toLowerCase(); | ||
tables.ths = function () { | ||
var out = "", i = 0, hs = [].slice.apply(arguments); | ||
var out = '', | ||
i = 0, | ||
hs = [].slice.apply(arguments); | ||
for (i; i < hs.length; i += 1) { | ||
@@ -42,3 +45,3 @@ out += tables.th(hs[i]) + '\n'; | ||
tables.tds = function () { | ||
var out = "", i = 0, ds = [].slice.apply(arguments); | ||
var out = '', i = 0, ds = [].slice.apply(arguments); | ||
for (i; i < ds.length; i += 1) { | ||
@@ -50,23 +53,24 @@ out += tables.td(ds[i]) + '\n'; | ||
tables.thead = function () { | ||
var out, i = 0, hs = [].slice.apply(arguments); | ||
out = "<thead>\n"; | ||
out += "<tr>\n"; | ||
var out, | ||
hs = [].slice.apply(arguments); | ||
out = '<thead>\n'; | ||
out += '<tr>\n'; | ||
out += tables.ths.apply(this, hs); | ||
out += "</tr>\n"; | ||
out += "</thead>\n"; | ||
out += '</tr>\n'; | ||
out += '</thead>\n'; | ||
return out; | ||
}; | ||
tables.tr = function () { | ||
var out, i = 0, cs = [].slice.apply(arguments); | ||
out = "<tr>\n"; | ||
var out, | ||
cs = [].slice.apply(arguments); | ||
out = '<tr>\n'; | ||
out += tables.tds.apply(this, cs); | ||
out += "</tr>\n"; | ||
out += '</tr>\n'; | ||
return out; | ||
}; | ||
filter = function (text) { | ||
var i = 0, lines = text.split('\n'), line, hs, rows, out = []; | ||
var i = 0, lines = text.split('\n'), line, hs, out = []; | ||
for (i; i < lines.length; i += 1) { | ||
line = lines[i]; | ||
// looks like a table heading | ||
if (line.trim().match(/^[|]{1}.*[|]{1}$/)) { | ||
if (line.trim().match(/^[|].*[|]$/)) { | ||
line = line.trim(); | ||
@@ -78,4 +82,3 @@ var tbl = []; | ||
line = lines[++i]; | ||
if (!line.trim().match(/^[|]{1}[-=|: ]+[|]{1}$/)) { | ||
// not a table rolling back | ||
if (!line.trim().match(/^[|][-=|: ]+[|]$/)) { | ||
line = lines[--i]; | ||
@@ -85,3 +88,3 @@ } else { | ||
tbl.push('<tbody>'); | ||
while (line.trim().match(/^[|]{1}.*[|]{1}$/)) { | ||
while (line.trim().match(/^[|].*[|]$/)) { | ||
line = line.trim(); | ||
@@ -93,3 +96,2 @@ tbl.push(tables.tr.apply(this, line.substring(1, line.length - 1).split('|'))); | ||
tbl.push('</table>'); | ||
// we are done with this table and we move along | ||
out.push(tbl.join('\n')); | ||
@@ -110,8 +112,5 @@ continue; | ||
}; | ||
// Client-side export | ||
if (typeof window !== 'undefined' && window.Showdown && window.Showdown.extensions) { | ||
window.Showdown.extensions.table = table; | ||
if (typeof window !== 'undefined' && window.showdown && window.showdown.extensions) { | ||
window.showdown.extensions.table = table; | ||
} | ||
// Server-side export | ||
if (typeof module !== 'undefined') { | ||
@@ -118,0 +117,0 @@ module.exports = table; |
@@ -1,4 +0,4 @@ | ||
/*! showdown-table 24-01-2015 */ | ||
/*! showdown-table 17-06-2015 */ | ||
!function(){var a=function(a){var b,c={},d="text-align:left;";return c.th=function(a){if(""===a.trim())return"";var b=a.trim().replace(/ /g,"_").toLowerCase();return'<th id="'+b+'" style="'+d+'">'+a+"</th>"},c.td=function(b){return'<td style="'+d+'">'+a.makeHtml(b)+"</td>"},c.ths=function(){var a="",b=0,d=[].slice.apply(arguments);for(b;b<d.length;b+=1)a+=c.th(d[b])+"\n";return a},c.tds=function(){var a="",b=0,d=[].slice.apply(arguments);for(b;b<d.length;b+=1)a+=c.td(d[b])+"\n";return a},c.thead=function(){var a,b=[].slice.apply(arguments);return a="<thead>\n",a+="<tr>\n",a+=c.ths.apply(this,b),a+="</tr>\n",a+="</thead>\n"},c.tr=function(){var a,b=[].slice.apply(arguments);return a="<tr>\n",a+=c.tds.apply(this,b),a+="</tr>\n"},b=function(a){var b,d,e=0,f=a.split("\n"),g=[];for(e;e<f.length;e+=1){if(b=f[e],b.trim().match(/^[|]{1}.*[|]{1}$/)){b=b.trim();var h=[];if(h.push("<table>"),d=b.substring(1,b.length-1).split("|"),h.push(c.thead.apply(this,d)),b=f[++e],b.trim().match(/^[|]{1}[-=|: ]+[|]{1}$/)){for(b=f[++e],h.push("<tbody>");b.trim().match(/^[|]{1}.*[|]{1}$/);)b=b.trim(),h.push(c.tr.apply(this,b.substring(1,b.length-1).split("|"))),b=f[++e];h.push("</tbody>"),h.push("</table>"),g.push(h.join("\n"));continue}b=f[--e]}g.push(b)}return g.join("\n")},[{type:"lang",filter:b}]};"undefined"!=typeof window&&window.Showdown&&window.Showdown.extensions&&(window.Showdown.extensions.table=a),"undefined"!=typeof module&&(module.exports=a)}(); | ||
!function(){"use strict";var a=function(a){var b,c={},d="text-align:left;";return c.th=function(a){if(""===a.trim())return"";var b=a.trim().replace(/ /g,"_").toLowerCase();return'<th id="'+b+'" style="'+d+'">'+a+"</th>"},c.td=function(b){return'<td style="'+d+'">'+a.makeHtml(b)+"</td>"},c.ths=function(){var a="",b=0,d=[].slice.apply(arguments);for(b;b<d.length;b+=1)a+=c.th(d[b])+"\n";return a},c.tds=function(){var a="",b=0,d=[].slice.apply(arguments);for(b;b<d.length;b+=1)a+=c.td(d[b])+"\n";return a},c.thead=function(){var a,b=[].slice.apply(arguments);return a="<thead>\n",a+="<tr>\n",a+=c.ths.apply(this,b),a+="</tr>\n",a+="</thead>\n"},c.tr=function(){var a,b=[].slice.apply(arguments);return a="<tr>\n",a+=c.tds.apply(this,b),a+="</tr>\n"},b=function(a){var b,d,e=0,f=a.split("\n"),g=[];for(e;e<f.length;e+=1){if(b=f[e],b.trim().match(/^[|].*[|]$/)){b=b.trim();var h=[];if(h.push("<table>"),d=b.substring(1,b.length-1).split("|"),h.push(c.thead.apply(this,d)),b=f[++e],b.trim().match(/^[|][-=|: ]+[|]$/)){for(b=f[++e],h.push("<tbody>");b.trim().match(/^[|].*[|]$/);)b=b.trim(),h.push(c.tr.apply(this,b.substring(1,b.length-1).split("|"))),b=f[++e];h.push("</tbody>"),h.push("</table>"),g.push(h.join("\n"));continue}b=f[--e]}g.push(b)}return g.join("\n")},[{type:"lang",filter:b}]};"undefined"!=typeof window&&window.showdown&&window.showdown.extensions&&(window.showdown.extensions.table=a),"undefined"!=typeof module&&(module.exports=a)}(); | ||
//# sourceMappingURL=showdown-table.min.js.map |
module.exports = function (grunt) { | ||
'use strict'; | ||
require('shelljs/global'); | ||
var config = { | ||
@@ -18,2 +16,11 @@ pkg: grunt.file.readJSON('package.json'), | ||
}, | ||
comments: { | ||
js: { | ||
options: { | ||
singleline: true, | ||
multiline: true | ||
}, | ||
src: ['<%= concat.dist.dest %>'] | ||
} | ||
}, | ||
uglify: { | ||
@@ -31,13 +38,20 @@ options: { | ||
jshint: { | ||
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js'] | ||
options: { | ||
jshintrc: '.jshintrc' | ||
}, | ||
files: [ | ||
'Gruntfile.js', | ||
'src/**/*.js', | ||
'test/**/*.js' | ||
] | ||
}, | ||
jscs: { | ||
options: { | ||
config: '.jscs.json', | ||
files: [ | ||
'Gruntfile.js', | ||
'src/**/*.js', | ||
'test/**/*.js' | ||
] | ||
} | ||
config: '.jscs.json' | ||
}, | ||
files: [ | ||
'Gruntfile.js', | ||
'src/**/*.js', | ||
'test/**/*.js' | ||
] | ||
}, | ||
@@ -58,16 +72,2 @@ changelog: { | ||
} | ||
}, | ||
// Client-side tests | ||
mocha: { | ||
test: { | ||
src: ['test/browser.html'], | ||
options: { | ||
run: true | ||
} | ||
} | ||
}, | ||
githooks: { | ||
all: { | ||
'pre-commit': 'pre-commit' | ||
} | ||
} | ||
@@ -78,22 +78,9 @@ }; | ||
grunt.loadNpmTasks('grunt-contrib-concat'); | ||
grunt.loadNpmTasks('grunt-contrib-uglify'); | ||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-simple-mocha'); | ||
grunt.loadNpmTasks('grunt-mocha'); | ||
grunt.loadNpmTasks('grunt-jscs'); | ||
grunt.loadNpmTasks('grunt-conventional-changelog'); | ||
grunt.loadNpmTasks('grunt-githooks'); | ||
require('load-grunt-tasks')(grunt); | ||
grunt.registerTask('lint', ['jshint', 'jscs']); | ||
grunt.registerTask('test', ['lint', 'mocha', 'simplemocha']); | ||
grunt.registerTask('build', ['test', 'concat', 'uglify']); | ||
grunt.registerTask('pre-commit', ['build', 'add-compressed-to-git']); | ||
grunt.registerTask('test', ['lint', 'simplemocha']); | ||
grunt.registerTask('build', ['test', 'concat', 'comments', 'uglify']); | ||
// Add compressed and minified files before committing | ||
grunt.registerTask('add-compressed-to-git', function () { | ||
exec('git add dist/'); | ||
}); | ||
grunt.registerTask('default', []); | ||
}; |
{ | ||
"name": "showdown-table", | ||
"version": "0.0.2", | ||
"description": "Add markdown table favor to showdown", | ||
"version": "1.0.1", | ||
"description": "Add markdown table flavor to showdown", | ||
"keywords": [ | ||
@@ -9,6 +9,6 @@ "markdown", | ||
"showdown extension", | ||
"table" | ||
"tables" | ||
], | ||
"author": "John Fraser", | ||
"license": "BSD", | ||
"author": "Estev�o Soares dos Santos", | ||
"license": "BSD-2-Clause", | ||
"repository": { | ||
@@ -22,26 +22,22 @@ "type": "git", | ||
}, | ||
"main": "./dist/showdown-table-extension.js", | ||
"main": "./dist/showdown-table.js", | ||
"scripts": { | ||
"postinstall": "grunt githooks", | ||
"test": "grunt test" | ||
}, | ||
"dependencies": { | ||
"showdown": "0.x.x" | ||
"showdown": "1.0.x" | ||
}, | ||
"devDependencies": { | ||
"chai": "^1.10.0", | ||
"chai": "^2.3.0", | ||
"grunt": "^0.4.5", | ||
"grunt-cli": "^0.1.13", | ||
"load-grunt-tasks": "^3.2.0", | ||
"grunt-contrib-concat": "^0.5.0", | ||
"grunt-contrib-jshint": "^0.10.0", | ||
"grunt-contrib-uglify": "^0.7.0", | ||
"grunt-contrib-uglify": "^0.6.0", | ||
"grunt-conventional-changelog": "^1.1.0", | ||
"grunt-githooks": "^0.3.1", | ||
"grunt-jscs": "^1.2.0", | ||
"grunt-mocha": "^0.4.11", | ||
"grunt-simple-mocha": "^0.4.0", | ||
"jscs": "^1.10.0", | ||
"mocha": "^2.1.0", | ||
"shelljs": "^0.3.0" | ||
"grunt-stripcomments": "^0.3.1" | ||
} | ||
} |
Showdown's Table Extension | ||
========================== | ||
[](https://travis-ci.org/showdownjs/table-extension.svg) [](http://badge.fury.io/js/showdown-table) [](http://badge.fury.io/bo/showdown-table) | ||
[](https://travis-ci.org/showdownjs/table-extension) [](http://badge.fury.io/js/showdown-table) [](http://badge.fury.io/bo/showdown-table) | ||
@@ -40,3 +40,3 @@ ------ | ||
var converter = new Showdown.converter({extensions: ['table']}); | ||
var converter = new showdown.Converter({extensions: ['table']}); | ||
@@ -46,3 +46,3 @@ ## Example | ||
```javascript | ||
var converter = new Showdown.converter({extensions: ['table']}), | ||
var converter = new showdown.Converter({extensions: ['table']}), | ||
input = '| Col 1 | Col 2 |' + | ||
@@ -77,2 +77,1 @@ '|======== |====================================================|' + | ||
These files are distributed under BSD license. For more information, please check the [LICENSE file](https://github.com/showdownjs/table-extension/blob/master/LICENSE) in the source code. | ||
@@ -7,5 +7,5 @@ (function () { | ||
var fs = require('fs'), | ||
extension = require('../src/table.js'), | ||
extension = require('../src/showdown-table.js'), | ||
showdown = require('showdown'), | ||
converter = new showdown.converter({extensions: [extension]}), | ||
converter = new showdown.Converter({extensions: [extension]}), | ||
cases = fs.readdirSync('test/cases/') | ||
@@ -12,0 +12,0 @@ .filter(filter()) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
11
-21.43%0
-100%1
-50%0
-100%43041
-37.48%34
-19.05%510
-0.58%75
-1.32%+ Added
- Removed
Updated