diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-06 13:44:14 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-06 13:44:14 -0700 |
commit | 014b2f9c6902235216fee390078ece0049344c0b (patch) | |
tree | 4b7a40abe74cce7b961f8a3bc63da9d4f044b315 /lib/parse/langs.js | |
parent | fb26b634ce2f332bcc3a8764009bdc65a2245f35 (diff) | |
parent | 65cb23feabb7ae311f18c5f50978686d202dafec (diff) | |
download | gitbook-014b2f9c6902235216fee390078ece0049344c0b.zip gitbook-014b2f9c6902235216fee390078ece0049344c0b.tar.gz gitbook-014b2f9c6902235216fee390078ece0049344c0b.tar.bz2 |
Merge pull request #35 from GitbookIO/feature/multilangs
Fix #34: Feature/multilangs
Diffstat (limited to 'lib/parse/langs.js')
-rw-r--r-- | lib/parse/langs.js | 23 |
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 |