mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-17 08:05:19 +00:00
6c5c8e6eb7
And cleanup Summary parsing
25 lines
585 B
JavaScript
25 lines
585 B
JavaScript
var _ = require("lodash");
|
|
var parseEntries = require("./summary").entries;
|
|
|
|
|
|
var parseLangs = function(content) {
|
|
var entries = parseEntries(content);
|
|
|
|
return {
|
|
list: _.chain(entries)
|
|
.filter(function(entry) {
|
|
return Boolean(entry.path);
|
|
})
|
|
.map(function(entry) {
|
|
return {
|
|
title: entry.title,
|
|
path: entry.path,
|
|
lang: entry.path.replace("/", "")
|
|
};
|
|
})
|
|
.value()
|
|
};
|
|
};
|
|
|
|
|
|
module.exports = parseLangs; |