diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-02-19 13:14:52 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 12:32:13 +0100 |
commit | 9e99b5850fd866fc2f9196993a0ae7e342311558 (patch) | |
tree | e430d039378e159f9046095e6f35285ecf6497fe /packages/gitbook-html/lib/langs.js | |
parent | eb0bf31baa6cb903ba4242ae5a3866ff67aeb97c (diff) | |
download | gitbook-9e99b5850fd866fc2f9196993a0ae7e342311558.zip gitbook-9e99b5850fd866fc2f9196993a0ae7e342311558.tar.gz gitbook-9e99b5850fd866fc2f9196993a0ae7e342311558.tar.bz2 |
Base code
Diffstat (limited to 'packages/gitbook-html/lib/langs.js')
-rwxr-xr-x | packages/gitbook-html/lib/langs.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/gitbook-html/lib/langs.js b/packages/gitbook-html/lib/langs.js new file mode 100755 index 0000000..1042dcb --- /dev/null +++ b/packages/gitbook-html/lib/langs.js @@ -0,0 +1,24 @@ +var _ = require('lodash'); +var parseEntries = require('./summary').entries; + +// HTML -> Languages +function parseLangs(content) { + return parseEntries(content); +} + +// Languages -> HTML +function langsToText(langs) { + var bl = '\n'; + var content = '<h1>Languages</h1>'+bl+bl; + + content += '<ul>' + bl; + _.each(langs, function(lang) { + content = content + ' <li><a href="'+lang.path+'">'+lang.title+'</a></li>'+bl; + }); + content += '</ul>' + bl; + + return content; +} + +module.exports = parseLangs; +module.exports.toText = langsToText; |