diff options
Diffstat (limited to 'lib/parse/page.js')
-rw-r--r-- | lib/parse/page.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/parse/page.js b/lib/parse/page.js index 09670b8..505d70f 100644 --- a/lib/parse/page.js +++ b/lib/parse/page.js @@ -70,6 +70,19 @@ function parsePage(src) { .filter(function(section) { return !_.isEmpty(section); }) + .reduce(function(sections, section) { + var last = _.last(sections); + + // Merge normal sections together + if(last && last.type === section.type && last.type === 'normal') { + last.push.apply(last, [{'type': 'hr'}].concat(section)); + } else { + // Add to list of sections + sections.push(section); + } + + return sections; + }, []) .map(function(section) { // Generate a uniqueId to identify this section in our code var id = _.uniqueId('gitbook_'); |