summaryrefslogtreecommitdiffstats
path: root/lib/parse
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parse')
-rw-r--r--lib/parse/index.js1
-rw-r--r--lib/parse/langs.js23
2 files changed, 24 insertions, 0 deletions
diff --git a/lib/parse/index.js b/lib/parse/index.js
index 951e401..ec98347 100644
--- a/lib/parse/index.js
+++ b/lib/parse/index.js
@@ -1,5 +1,6 @@
module.exports = {
summary: require('./summary'),
+ langs: require('./langs'),
page: require('./page'),
progress: require('./progress'),
navigation: require('./navigation'),
diff --git a/lib/parse/langs.js b/lib/parse/langs.js
new file mode 100644
index 0000000..46c3a46
--- /dev/null
+++ b/lib/parse/langs.js
@@ -0,0 +1,23 @@
+var _ = require("lodash")
+var parseSummary = require("./summary");
+
+var parseLangs = function(content) {
+ var summary = parseSummary(content);
+
+ return {
+ list: _.chain(summary.chapters)
+ .filter(function(entry) {
+ return entry.path != null;
+ })
+ .map(function(entry) {
+ return {
+ title: entry.title,
+ path: entry.path,
+ lang: entry.path.replace("/", "")
+ };
+ })
+ .value()
+ }
+};
+
+module.exports = parseLangs; \ No newline at end of file