mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-22 18:43:29 +00:00
Merge pull request #489 from codepiano/fork
bugfix,init page object's lexed attribute.
This commit is contained in:
@@ -120,7 +120,7 @@ Generator.prototype.prepareFile = function(content, _input) {
|
||||
.then(function() {
|
||||
// Lex, parse includes and get
|
||||
// Get HTML generated sections
|
||||
return parse.page(page.content, {
|
||||
return parse.page(page, {
|
||||
// Local files path
|
||||
dir: path.dirname(_input) || '/',
|
||||
|
||||
|
||||
+3
-2
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user