diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-05-02 16:12:07 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-12-22 12:32:17 +0100 |
commit | c3a417a9834ba3c25ceb20a3cb650fa0384c60d0 (patch) | |
tree | bdbffac34a15636265e834b9bf0c484054426135 /packages/gitbook-html/lib/summary.js | |
parent | 9e88003d7373e2e7efac862494a9a0db4847f617 (diff) | |
download | gitbook-c3a417a9834ba3c25ceb20a3cb650fa0384c60d0.zip gitbook-c3a417a9834ba3c25ceb20a3cb650fa0384c60d0.tar.gz gitbook-c3a417a9834ba3c25ceb20a3cb650fa0384c60d0.tar.bz2 |
Adapt for gitbook v3
Diffstat (limited to 'packages/gitbook-html/lib/summary.js')
-rwxr-xr-x | packages/gitbook-html/lib/summary.js | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/packages/gitbook-html/lib/summary.js b/packages/gitbook-html/lib/summary.js index 8d716d6..e55719b 100755 --- a/packages/gitbook-html/lib/summary.js +++ b/packages/gitbook-html/lib/summary.js @@ -3,10 +3,14 @@ var dom = require('./dom'); var SELECTOR_LIST = 'ol, ul'; var SELECTOR_LINK = '> a, p > a'; - var BL = '\n'; -// Find a list +/** + Find a list + + @param {cheerio.Node} + @return {cheerio.Node} +*/ function findList($parent) { var $container = $parent.children('.olist'); if ($container.length > 0) $parent = $container.first(); @@ -14,7 +18,13 @@ function findList($parent) { return $parent.children('ul, ol'); } -// Parse a ul list and return list of chapters recursvely +/** + Parse a ul list and return list of chapters recursvely + + @param {cheerio.Node} + @param {cheerio.DOM} + @return {Array} +*/ function parseList($ul, $) { var articles = []; @@ -44,7 +54,12 @@ function parseList($ul, $) { return articles; } -// HTML -> Summary +/** + Parse an HTML content into a tree of articles/parts + + @param {String} html + @return {Object} +*/ function parseSummary(html) { var $ = dom.parse(html); var $root = dom.cleanup(dom.root($), $); |