bugfix,init page object's lexed attribute.

the page object's attribute 'lexed' is not correctly inited.so when
use page.lexed to generate the search index file,nothing will be
indexed.
This commit is contained in:
codepiano
2014-10-31 18:00:09 +08:00
parent 1e4632080b
commit 9da10e2b25
2 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -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) || '/',
// Project's include folder
+3 -2
View File
@@ -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.dir, options.includes_dir], options.variables)))
page.lexed = (_.isArray(page.content) ? page.content : lex(include(page.content, [options.dir, options.includes_dir], options.variables)))
return page.lexed
.map(function(section) {
// Transform given type
if(section.type === 'exercise') {