summaryrefslogtreecommitdiffstats
path: root/lib/parse/langs.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/parse/langs.js')
-rw-r--r--lib/parse/langs.js23
1 files changed, 23 insertions, 0 deletions
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