ecmarkdown
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -70,2 +70,11 @@ 'use strict'; | ||
exports.fragment = function (atoms) { | ||
var container = $('<template>'); | ||
atoms.forEach(function (atom) { | ||
container.append(atom); | ||
}); | ||
return beautify(container.html()); | ||
}; | ||
exports.variable = function (first, rest) { | ||
@@ -72,0 +81,0 @@ return $('<var>').text(first + rest); |
'use strict'; | ||
var parser = require('./generated-parser.js'); | ||
var escapeHtml = require('escape-html'); | ||
@@ -11,1 +12,5 @@ exports.list = function (ecmarkdown) { | ||
}; | ||
exports.fragment = function (ecmarkdown) { | ||
return parser.parse(escapeHtml(ecmarkdown.trim()), { startRule: 'fragment' }); | ||
}; |
@@ -32,3 +32,3 @@ module.exports = (function() { | ||
peg$startRuleFunctions = { list: peg$parselist, paragraph: peg$parseparagraph }, | ||
peg$startRuleFunctions = { list: peg$parselist, paragraph: peg$parseparagraph, fragment: peg$parsefragment }, | ||
peg$startRuleFunction = peg$parselist, | ||
@@ -46,49 +46,50 @@ | ||
peg$c9 = function(atoms) { return actions.paragraph(atoms); }, | ||
peg$c10 = " ", | ||
peg$c11 = { type: "literal", value: " ", description: "\" \"" }, | ||
peg$c12 = function(spaces) { return actions.dents(spaces, state); }, | ||
peg$c13 = function(atoms) { return actions.listItem(atoms); }, | ||
peg$c14 = "_", | ||
peg$c15 = { type: "literal", value: "_", description: "\"_\"" }, | ||
peg$c16 = void 0, | ||
peg$c17 = function(first, rest) { return actions.variable(first, rest); }, | ||
peg$c18 = /^[^\n_ ]/, | ||
peg$c19 = { type: "class", value: "[^\\n_ ]", description: "[^\\n_ ]" }, | ||
peg$c20 = "`", | ||
peg$c21 = { type: "literal", value: "`", description: "\"`\"" }, | ||
peg$c22 = /^[^\n`]/, | ||
peg$c23 = { type: "class", value: "[^\\n`]", description: "[^\\n`]" }, | ||
peg$c24 = function(content) { return actions.code(content); }, | ||
peg$c25 = "\"", | ||
peg$c26 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
peg$c27 = /^[^\n"]/, | ||
peg$c28 = { type: "class", value: "[^\\n\"]", description: "[^\\n\"]" }, | ||
peg$c29 = function(content) { return actions.string(content); }, | ||
peg$c30 = "*", | ||
peg$c31 = { type: "literal", value: "*", description: "\"*\"" }, | ||
peg$c32 = /^[^\n* ]/, | ||
peg$c33 = { type: "class", value: "[^\\n* ]", description: "[^\\n* ]" }, | ||
peg$c34 = function(content) { return actions.value(content); }, | ||
peg$c35 = "~", | ||
peg$c36 = { type: "literal", value: "~", description: "\"~\"" }, | ||
peg$c37 = /^[^\n~ ]/, | ||
peg$c38 = { type: "class", value: "[^\\n~ ]", description: "[^\\n~ ]" }, | ||
peg$c39 = function(content) { return actions.specConstant(content); }, | ||
peg$c40 = "|", | ||
peg$c41 = { type: "literal", value: "|", description: "\"|\"" }, | ||
peg$c42 = /^[a-z]/i, | ||
peg$c43 = { type: "class", value: "[a-z]i", description: "[a-z]i" }, | ||
peg$c44 = null, | ||
peg$c45 = "[", | ||
peg$c46 = { type: "literal", value: "[", description: "\"[\"" }, | ||
peg$c47 = /^[^\]]/, | ||
peg$c48 = { type: "class", value: "[^\\]]", description: "[^\\]]" }, | ||
peg$c49 = "]", | ||
peg$c50 = { type: "literal", value: "]", description: "\"]\"" }, | ||
peg$c51 = "_opt", | ||
peg$c52 = { type: "literal", value: "_opt", description: "\"_opt\"" }, | ||
peg$c53 = function(name, params, opt) { return actions.nonterminal(name, | ||
peg$c10 = function(atoms) { return actions.fragment(atoms); }, | ||
peg$c11 = " ", | ||
peg$c12 = { type: "literal", value: " ", description: "\" \"" }, | ||
peg$c13 = function(spaces) { return actions.dents(spaces, state); }, | ||
peg$c14 = function(atoms) { return actions.listItem(atoms); }, | ||
peg$c15 = "_", | ||
peg$c16 = { type: "literal", value: "_", description: "\"_\"" }, | ||
peg$c17 = void 0, | ||
peg$c18 = function(first, rest) { return actions.variable(first, rest); }, | ||
peg$c19 = /^[^\n_ ]/, | ||
peg$c20 = { type: "class", value: "[^\\n_ ]", description: "[^\\n_ ]" }, | ||
peg$c21 = "`", | ||
peg$c22 = { type: "literal", value: "`", description: "\"`\"" }, | ||
peg$c23 = /^[^\n`]/, | ||
peg$c24 = { type: "class", value: "[^\\n`]", description: "[^\\n`]" }, | ||
peg$c25 = function(content) { return actions.code(content); }, | ||
peg$c26 = "\"", | ||
peg$c27 = { type: "literal", value: "\"", description: "\"\\\"\"" }, | ||
peg$c28 = /^[^\n"]/, | ||
peg$c29 = { type: "class", value: "[^\\n\"]", description: "[^\\n\"]" }, | ||
peg$c30 = function(content) { return actions.string(content); }, | ||
peg$c31 = "*", | ||
peg$c32 = { type: "literal", value: "*", description: "\"*\"" }, | ||
peg$c33 = /^[^\n* ]/, | ||
peg$c34 = { type: "class", value: "[^\\n* ]", description: "[^\\n* ]" }, | ||
peg$c35 = function(content) { return actions.value(content); }, | ||
peg$c36 = "~", | ||
peg$c37 = { type: "literal", value: "~", description: "\"~\"" }, | ||
peg$c38 = /^[^\n~ ]/, | ||
peg$c39 = { type: "class", value: "[^\\n~ ]", description: "[^\\n~ ]" }, | ||
peg$c40 = function(content) { return actions.specConstant(content); }, | ||
peg$c41 = "|", | ||
peg$c42 = { type: "literal", value: "|", description: "\"|\"" }, | ||
peg$c43 = /^[a-z]/i, | ||
peg$c44 = { type: "class", value: "[a-z]i", description: "[a-z]i" }, | ||
peg$c45 = null, | ||
peg$c46 = "[", | ||
peg$c47 = { type: "literal", value: "[", description: "\"[\"" }, | ||
peg$c48 = /^[^\]]/, | ||
peg$c49 = { type: "class", value: "[^\\]]", description: "[^\\]]" }, | ||
peg$c50 = "]", | ||
peg$c51 = { type: "literal", value: "]", description: "\"]\"" }, | ||
peg$c52 = "_opt", | ||
peg$c53 = { type: "literal", value: "_opt", description: "\"_opt\"" }, | ||
peg$c54 = function(name, params, opt) { return actions.nonterminal(name, | ||
params, opt); }, | ||
peg$c54 = /^[^\n]/, | ||
peg$c55 = { type: "class", value: "[^\\n]", description: "[^\\n]" }, | ||
peg$c55 = /^[^\n]/, | ||
peg$c56 = { type: "class", value: "[^\\n]", description: "[^\\n]" }, | ||
@@ -447,2 +448,25 @@ peg$currPos = 0, | ||
function peg$parsefragment() { | ||
var s0, s1, s2; | ||
s0 = peg$currPos; | ||
s1 = []; | ||
s2 = peg$parseatom(); | ||
if (s2 !== peg$FAILED) { | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
s2 = peg$parseatom(); | ||
} | ||
} else { | ||
s1 = peg$c1; | ||
} | ||
if (s1 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c10(s1); | ||
} | ||
s0 = s1; | ||
return s0; | ||
} | ||
function peg$parsedents() { | ||
@@ -453,17 +477,17 @@ var s0, s1, s2; | ||
s1 = []; | ||
if (input.substr(peg$currPos, 2) === peg$c10) { | ||
s2 = peg$c10; | ||
if (input.substr(peg$currPos, 2) === peg$c11) { | ||
s2 = peg$c11; | ||
peg$currPos += 2; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c12); } | ||
} | ||
while (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (input.substr(peg$currPos, 2) === peg$c10) { | ||
s2 = peg$c10; | ||
if (input.substr(peg$currPos, 2) === peg$c11) { | ||
s2 = peg$c11; | ||
peg$currPos += 2; | ||
} else { | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c11); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c12); } | ||
} | ||
@@ -473,3 +497,3 @@ } | ||
peg$reportedPos = s0; | ||
s1 = peg$c12(s1); | ||
s1 = peg$c13(s1); | ||
} | ||
@@ -497,3 +521,3 @@ s0 = s1; | ||
peg$reportedPos = s0; | ||
s1 = peg$c13(s1); | ||
s1 = peg$c14(s1); | ||
} | ||
@@ -536,7 +560,7 @@ s0 = s1; | ||
if (input.charCodeAt(peg$currPos) === 95) { | ||
s1 = peg$c14; | ||
s1 = peg$c15; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
@@ -550,7 +574,7 @@ if (s1 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 95) { | ||
s6 = peg$c14; | ||
s6 = peg$c15; | ||
peg$currPos++; | ||
} else { | ||
s6 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
@@ -563,7 +587,7 @@ if (s6 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 95) { | ||
s9 = peg$c14; | ||
s9 = peg$c15; | ||
peg$currPos++; | ||
} else { | ||
s9 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
@@ -573,3 +597,3 @@ peg$silentFails--; | ||
peg$currPos = s8; | ||
s8 = peg$c16; | ||
s8 = peg$c17; | ||
} else { | ||
@@ -597,7 +621,7 @@ s8 = peg$c1; | ||
if (input.charCodeAt(peg$currPos) === 95) { | ||
s6 = peg$c14; | ||
s6 = peg$c15; | ||
peg$currPos++; | ||
} else { | ||
s6 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
@@ -610,7 +634,7 @@ if (s6 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 95) { | ||
s9 = peg$c14; | ||
s9 = peg$c15; | ||
peg$currPos++; | ||
} else { | ||
s9 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
@@ -620,3 +644,3 @@ peg$silentFails--; | ||
peg$currPos = s8; | ||
s8 = peg$c16; | ||
s8 = peg$c17; | ||
} else { | ||
@@ -647,11 +671,11 @@ s8 = peg$c1; | ||
if (input.charCodeAt(peg$currPos) === 95) { | ||
s4 = peg$c14; | ||
s4 = peg$c15; | ||
peg$currPos++; | ||
} else { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c15); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c16); } | ||
} | ||
if (s4 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c17(s2, s3); | ||
s1 = peg$c18(s2, s3); | ||
s0 = s1; | ||
@@ -683,3 +707,3 @@ } else { | ||
s1 = []; | ||
if (peg$c18.test(input.charAt(peg$currPos))) { | ||
if (peg$c19.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -689,3 +713,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c19); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
} | ||
@@ -695,3 +719,3 @@ if (s2 !== peg$FAILED) { | ||
s1.push(s2); | ||
if (peg$c18.test(input.charAt(peg$currPos))) { | ||
if (peg$c19.test(input.charAt(peg$currPos))) { | ||
s2 = input.charAt(peg$currPos); | ||
@@ -701,3 +725,3 @@ peg$currPos++; | ||
s2 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c19); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c20); } | ||
} | ||
@@ -721,7 +745,7 @@ } | ||
if (input.charCodeAt(peg$currPos) === 96) { | ||
s1 = peg$c20; | ||
s1 = peg$c21; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c21); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
} | ||
@@ -731,3 +755,3 @@ if (s1 !== peg$FAILED) { | ||
s3 = []; | ||
if (peg$c22.test(input.charAt(peg$currPos))) { | ||
if (peg$c23.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -737,3 +761,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c23); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
} | ||
@@ -743,3 +767,3 @@ if (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
if (peg$c22.test(input.charAt(peg$currPos))) { | ||
if (peg$c23.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -749,3 +773,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c23); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c24); } | ||
} | ||
@@ -762,11 +786,11 @@ } | ||
if (input.charCodeAt(peg$currPos) === 96) { | ||
s3 = peg$c20; | ||
s3 = peg$c21; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c21); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c22); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c24(s2); | ||
s1 = peg$c25(s2); | ||
s0 = s1; | ||
@@ -794,7 +818,7 @@ } else { | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s1 = peg$c25; | ||
s1 = peg$c26; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c27); } | ||
} | ||
@@ -804,3 +828,3 @@ if (s1 !== peg$FAILED) { | ||
s3 = []; | ||
if (peg$c27.test(input.charAt(peg$currPos))) { | ||
if (peg$c28.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -810,3 +834,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
} | ||
@@ -816,3 +840,3 @@ if (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
if (peg$c27.test(input.charAt(peg$currPos))) { | ||
if (peg$c28.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -822,3 +846,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c28); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c29); } | ||
} | ||
@@ -835,11 +859,11 @@ } | ||
if (input.charCodeAt(peg$currPos) === 34) { | ||
s3 = peg$c25; | ||
s3 = peg$c26; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c26); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c27); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c29(s2); | ||
s1 = peg$c30(s2); | ||
s0 = s1; | ||
@@ -867,7 +891,7 @@ } else { | ||
if (input.charCodeAt(peg$currPos) === 42) { | ||
s1 = peg$c30; | ||
s1 = peg$c31; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
} | ||
@@ -877,3 +901,3 @@ if (s1 !== peg$FAILED) { | ||
s3 = []; | ||
if (peg$c32.test(input.charAt(peg$currPos))) { | ||
if (peg$c33.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -883,3 +907,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c34); } | ||
} | ||
@@ -889,3 +913,3 @@ if (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
if (peg$c32.test(input.charAt(peg$currPos))) { | ||
if (peg$c33.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -895,3 +919,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c33); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c34); } | ||
} | ||
@@ -908,11 +932,11 @@ } | ||
if (input.charCodeAt(peg$currPos) === 42) { | ||
s3 = peg$c30; | ||
s3 = peg$c31; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c31); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c32); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c34(s2); | ||
s1 = peg$c35(s2); | ||
s0 = s1; | ||
@@ -940,7 +964,7 @@ } else { | ||
if (input.charCodeAt(peg$currPos) === 126) { | ||
s1 = peg$c35; | ||
s1 = peg$c36; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
} | ||
@@ -950,3 +974,3 @@ if (s1 !== peg$FAILED) { | ||
s3 = []; | ||
if (peg$c37.test(input.charAt(peg$currPos))) { | ||
if (peg$c38.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -956,3 +980,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
} | ||
@@ -962,3 +986,3 @@ if (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
if (peg$c37.test(input.charAt(peg$currPos))) { | ||
if (peg$c38.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -968,3 +992,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c38); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c39); } | ||
} | ||
@@ -981,11 +1005,11 @@ } | ||
if (input.charCodeAt(peg$currPos) === 126) { | ||
s3 = peg$c35; | ||
s3 = peg$c36; | ||
peg$currPos++; | ||
} else { | ||
s3 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c36); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c37); } | ||
} | ||
if (s3 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c39(s2); | ||
s1 = peg$c40(s2); | ||
s0 = s1; | ||
@@ -1013,7 +1037,7 @@ } else { | ||
if (input.charCodeAt(peg$currPos) === 124) { | ||
s1 = peg$c40; | ||
s1 = peg$c41; | ||
peg$currPos++; | ||
} else { | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
@@ -1023,3 +1047,3 @@ if (s1 !== peg$FAILED) { | ||
s3 = []; | ||
if (peg$c42.test(input.charAt(peg$currPos))) { | ||
if (peg$c43.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -1029,3 +1053,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
@@ -1035,3 +1059,3 @@ if (s4 !== peg$FAILED) { | ||
s3.push(s4); | ||
if (peg$c42.test(input.charAt(peg$currPos))) { | ||
if (peg$c43.test(input.charAt(peg$currPos))) { | ||
s4 = input.charAt(peg$currPos); | ||
@@ -1041,3 +1065,3 @@ peg$currPos++; | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c43); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c44); } | ||
} | ||
@@ -1055,7 +1079,7 @@ } | ||
if (input.charCodeAt(peg$currPos) === 91) { | ||
s4 = peg$c45; | ||
s4 = peg$c46; | ||
peg$currPos++; | ||
} else { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c46); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c47); } | ||
} | ||
@@ -1065,3 +1089,3 @@ if (s4 !== peg$FAILED) { | ||
s6 = []; | ||
if (peg$c47.test(input.charAt(peg$currPos))) { | ||
if (peg$c48.test(input.charAt(peg$currPos))) { | ||
s7 = input.charAt(peg$currPos); | ||
@@ -1071,3 +1095,3 @@ peg$currPos++; | ||
s7 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c48); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
@@ -1077,3 +1101,3 @@ if (s7 !== peg$FAILED) { | ||
s6.push(s7); | ||
if (peg$c47.test(input.charAt(peg$currPos))) { | ||
if (peg$c48.test(input.charAt(peg$currPos))) { | ||
s7 = input.charAt(peg$currPos); | ||
@@ -1083,3 +1107,3 @@ peg$currPos++; | ||
s7 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c48); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c49); } | ||
} | ||
@@ -1096,7 +1120,7 @@ } | ||
if (input.charCodeAt(peg$currPos) === 93) { | ||
s6 = peg$c49; | ||
s6 = peg$c50; | ||
peg$currPos++; | ||
} else { | ||
s6 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c50); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c51); } | ||
} | ||
@@ -1119,26 +1143,26 @@ if (s6 !== peg$FAILED) { | ||
if (s3 === peg$FAILED) { | ||
s3 = peg$c44; | ||
s3 = peg$c45; | ||
} | ||
if (s3 !== peg$FAILED) { | ||
if (input.substr(peg$currPos, 4) === peg$c51) { | ||
s4 = peg$c51; | ||
if (input.substr(peg$currPos, 4) === peg$c52) { | ||
s4 = peg$c52; | ||
peg$currPos += 4; | ||
} else { | ||
s4 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c52); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c53); } | ||
} | ||
if (s4 === peg$FAILED) { | ||
s4 = peg$c44; | ||
s4 = peg$c45; | ||
} | ||
if (s4 !== peg$FAILED) { | ||
if (input.charCodeAt(peg$currPos) === 124) { | ||
s5 = peg$c40; | ||
s5 = peg$c41; | ||
peg$currPos++; | ||
} else { | ||
s5 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c41); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c42); } | ||
} | ||
if (s5 !== peg$FAILED) { | ||
peg$reportedPos = s0; | ||
s1 = peg$c53(s2, s3, s4); | ||
s1 = peg$c54(s2, s3, s4); | ||
s0 = s1; | ||
@@ -1173,3 +1197,3 @@ } else { | ||
s0 = peg$currPos; | ||
if (peg$c54.test(input.charAt(peg$currPos))) { | ||
if (peg$c55.test(input.charAt(peg$currPos))) { | ||
s1 = input.charAt(peg$currPos); | ||
@@ -1179,3 +1203,3 @@ peg$currPos++; | ||
s1 = peg$FAILED; | ||
if (peg$silentFails === 0) { peg$fail(peg$c55); } | ||
if (peg$silentFails === 0) { peg$fail(peg$c56); } | ||
} | ||
@@ -1182,0 +1206,0 @@ if (s1 !== peg$FAILED) { |
{ | ||
"name": "ecmarkdown", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "A compiler for \"Ecmarkdown\" algorithm shorthand into HTML.", | ||
@@ -29,2 +29,3 @@ "main": "lib/ecmarkdown.js", | ||
"cheerio": "^0.17.0", | ||
"escape-html": "^1.0.1", | ||
"inline-elements": "^0.1.1", | ||
@@ -31,0 +32,0 @@ "js-beautify": "^1.5.4", |
@@ -46,3 +46,3 @@ # Ecmarkdown | ||
Every Ecmarkdown fragment is a either a **numeric list** or a **paragraph**. These two base productions can contain other productions. | ||
Every Ecmarkdown string is a either a **numeric list**, a **paragraph**, or a **fragment**. These base productions can contain other productions. | ||
@@ -53,2 +53,4 @@ **Numeric lists** are written as a series of lines, each starting with `1. `. Lines can be indented by multiples of exactly two spaces to indicate nesting. To convert a numeric list, use `ecmarkdown.list(stringOfText)` to get back HTML for the list (with root element `<ol>`). | ||
**Fragments** are also single lines of text, but unlike numeric lists and paragraphs, they are assumed to not contain any HTML. Thus, you can pass in `"<x>"` as a fragment, and you'll get back as the output HTML `"<x>"`. | ||
In the future we will unify these into a single parser that allows multiple paragraphs, multiple lists, and any combination thereof. But for now the above is what's fallen out of the work done so far. | ||
@@ -58,3 +60,3 @@ | ||
Within a paragraph or list item line, the following can be used: | ||
Within a paragraph, list item line, or fragment, the following can be used: | ||
@@ -61,0 +63,0 @@ **Variables** are written as `_x_` and are translated to `<var>x</var>`. Variables cannot contain spaces, but can contain underscores. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45053
1255
77
5
+ Addedescape-html@^1.0.1
+ Addedescape-html@1.0.3(transitive)