diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-01-22 18:21:30 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-01-22 18:21:30 +0100 |
commit | 0ba36c6f4ed316cc157c701abe4728d64da231b4 (patch) | |
tree | be6a43d28d1411fe60cac8405dde33b2b38e6a52 /lib/parsers.js | |
parent | c47093e82a1814dd421c37fc3cbef9512541d526 (diff) | |
download | gitbook-0ba36c6f4ed316cc157c701abe4728d64da231b4.zip gitbook-0ba36c6f4ed316cc157c701abe4728d64da231b4.tar.gz gitbook-0ba36c6f4ed316cc157c701abe4728d64da231b4.tar.bz2 |
Use external gitbook parsers
Diffstat (limited to 'lib/parsers.js')
-rw-r--r-- | lib/parsers.js | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/lib/parsers.js b/lib/parsers.js deleted file mode 100644 index 523cb87..0000000 --- a/lib/parsers.js +++ /dev/null @@ -1,34 +0,0 @@ -var _ = require("lodash"); -var path = require("path"); - -// This list is ordered by priority of parsers to use -var PARSER = [ - { - name: "markdown", - extensions: [".md", ".markdown"], - parser: require("gitbook-markdown") - }, - { - name: "asciidoc", - extensions: [".adoc", ".asciidoc"], - parser: require("gitbook-asciidoc") - } -]; - -// Return a specific parser according to an extension -function getParser(ext) { - return _.find(PARSER, function(input) { - return _.contains(input.extensions, ext); - }); -} - -// Return parser for a file -function getParserForFile(filename) { - return getParser(path.extname(filename)); -}; - -module.exports = { - extensions: _.flatten(_.pluck(PARSER, "extensions")), - get: getParser, - getForFile: getParserForFile -}; |