summaryrefslogtreecommitdiffstats
path: root/packages/gitbook-asciidoc/lib/langs.js
blob: 86da75ab1f425abd8d32fd1972f2ba3021fefe7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
var _ = require("lodash");
var parseEntries = require("./summary").entries;


var parseLangs = function(content) {
    var entries = parseEntries(content);

    return _.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;