diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-11-03 17:29:54 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-11-03 17:29:54 +0100 |
commit | 195374eceeb5812df3c14ee5fdb88ed7f3310a2b (patch) | |
tree | b06b57877ebe4e89d45e850bde3d2c3c0064f687 /lib/parse | |
parent | 1659778a776747f0e83c77cb8de7d038ff9072b7 (diff) | |
parent | 1502d65286eb36a76b8d0016f7bad64b9bf9f39f (diff) | |
download | gitbook-195374eceeb5812df3c14ee5fdb88ed7f3310a2b.zip gitbook-195374eceeb5812df3c14ee5fdb88ed7f3310a2b.tar.gz gitbook-195374eceeb5812df3c14ee5fdb88ed7f3310a2b.tar.bz2 |
Merge pull request #489 from codepiano/fork
bugfix,init page object's lexed attribute.
Diffstat (limited to 'lib/parse')
-rw-r--r-- | lib/parse/page.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/parse/page.js b/lib/parse/page.js index 56899fd..2cbbbf4 100644 --- a/lib/parse/page.js +++ b/lib/parse/page.js @@ -47,11 +47,12 @@ function quizQuestion(node) { } } -function parsePage(src, options) { +function parsePage(page, options) { options = options || {}; // Lex if not already lexed - return (_.isArray(src) ? src : lex(include(src, options.includer || function() { return undefined; }))) + page.lexed = (_.isArray(page.content) ? page.content : lex(include(page.content, options.includer || function() { return undefined; }))) + return page.lexed .map(function(section) { // Transform given type if(section.type === 'exercise') { |