summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/lib/readme.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2015-01-21 10:18:15 +0100
committerSamy Pessé <samypesse@gmail.com>2016-12-22 11:46:14 +0100
commita81a503ff0bbbf66f6fefb7090f8516071ae817a (patch)
tree5a255d8453a3c4705083c6a6a4eba2f76fee7acf /packages/gitbook-asciidoc/lib/readme.js
parent11893255d1167382b16871d2ca831c90a40af57d (diff)
downloadgitbook-a81a503ff0bbbf66f6fefb7090f8516071ae817a.zip
gitbook-a81a503ff0bbbf66f6fefb7090f8516071ae817a.tar.gz
gitbook-a81a503ff0bbbf66f6fefb7090f8516071ae817a.tar.bz2
Add base to parse asciidoc
Diffstat (limited to 'packages/gitbook-asciidoc/lib/readme.js')
-rwxr-xr-xpackages/gitbook-asciidoc/lib/readme.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/packages/gitbook-asciidoc/lib/readme.js b/packages/gitbook-asciidoc/lib/readme.js
new file mode 100755
index 0000000..6ca1a83
--- /dev/null
+++ b/packages/gitbook-asciidoc/lib/readme.js
@@ -0,0 +1,18 @@
+var _ = require('lodash');
+var cheerio = require('cheerio');
+
+var convert = require('./utils/convert');
+
+function parseReadme(src) {
+ var html = convert(src);
+ $ = cheerio.load(html);
+
+ return {
+ title: $("h1:first-child").text().trim(),
+ description: $("div.paragraph").first().text().trim()
+ };
+}
+
+
+// Exports
+module.exports = parseReadme;