Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor to remove regular expressions #96

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
build/
components/
coverage/
lib/expressions.js
build.js
mdast.js
mdast.min.js
Expand Down
2 changes: 0 additions & 2 deletions .jscs.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
"components/",
"coverage/",
"node_modules/",
"lib/expressions.js",
"script/build-expressions.js",
"build.js",
"mdast.js",
"mdast.min.js"
Expand Down
5 changes: 4 additions & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
"scripts": [
"index.js",
"lib/defaults.js",
"lib/expressions.js",
"lib/parse.js",
"lib/stringify.js",
"lib/utilities.js"
],
"json": [
"lib/block-elements.json",
"lib/escape.json"
]
}
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
var unified = require('unified');
var Parser = require('./lib/parse.js');
var Compiler = require('./lib/stringify.js');
var escape = require('./lib/escape.json');

/*
* Exports.
Expand All @@ -26,5 +27,8 @@ var Compiler = require('./lib/stringify.js');
module.exports = unified({
'name': 'mdast',
'Parser': Parser,
'Compiler': Compiler
'Compiler': Compiler,
'data': {
'escape': escape
}
});
52 changes: 52 additions & 0 deletions lib/block-elements.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
[
"article",
"header",
"aside",
"hgroup",
"blockquote",
"hr",
"iframe",
"body",
"li",
"map",
"button",
"object",
"canvas",
"ol",
"caption",
"output",
"col",
"p",
"colgroup",
"pre",
"dd",
"progress",
"div",
"section",
"dl",
"table",
"td",
"dt",
"tbody",
"embed",
"textarea",
"fieldset",
"tfoot",
"figcaption",
"th",
"figure",
"thead",
"footer",
"tr",
"form",
"ul",
"h1",
"h2",
"h3",
"h4",
"h5",
"h6",
"video",
"script",
"style"
]
75 changes: 75 additions & 0 deletions lib/escape.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"default": [
"\\",
"`",
"*",
"{",
"}",
"[",
"]",
"(",
")",
"#",
"+",
"-",
".",
"!",
"_",
">"
],
"gfm": [
"\\",
"`",
"*",
"{",
"}",
"[",
"]",
"(",
")",
"#",
"+",
"-",
".",
"!",
"_",
">",
"~",
"|"
],
"commonmark": [
"\\",
"`",
"*",
"{",
"}",
"[",
"]",
"(",
")",
"#",
"+",
"-",
".",
"!",
"_",
">",
"~",
"|",
"\n",
"\"",
"$",
"%",
"&",
"'",
",",
"/",
":",
";",
"<",
"=",
"?",
"@",
"^"
]
}
74 changes: 0 additions & 74 deletions lib/expressions.js

This file was deleted.

22 changes: 22 additions & 0 deletions lib/inline-text-stop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"default": [
"\\",
"<",
"!",
"[",
"_",
"*",
"`"
],
"gfm": [
"~",
"http://",
"https://",
"mailto:"
],
"commonmark": [],
"pedantic": [],
"breaks": [
"\n"
]
}
Loading