From b711a2937e5c9f9a4553d9c32dd15c64ff912d37 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 13 Aug 2022 16:24:35 +0300 Subject: [PATCH] some fixes... Signed-off-by: Alex A. Naanou --- pwiki/page.js | 4 ++-- pwiki/parser.js | 13 +++++++------ pwiki2-test.js | 8 ++++++++ 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/pwiki/page.js b/pwiki/page.js index a710f0d..5595d8e 100755 --- a/pwiki/page.js +++ b/pwiki/page.js @@ -675,12 +675,12 @@ object.Constructor('Page', BasePage, { var outer_filters = state.filters state.filters = this.__parser__.normalizeFilters(filters) var res = - this.parse(ast, state) + await this.parse(ast, state) .iter() .flat() .join('') state.filters = outer_filters - return { data: await res } } } }, + return { data: res } } } }, // // @include() // diff --git a/pwiki/parser.js b/pwiki/parser.js index 1f015e3..5587c4b 100755 --- a/pwiki/parser.js +++ b/pwiki/parser.js @@ -461,12 +461,13 @@ module.BaseParser = { // NOTE: we need to await for ast here as we need stage 2 of // parsing to happen AFTER everything else completes... - return (await ast) - // post handlers... - .map(function(section){ - return typeof(section) == 'function' ? - section.call(page, state) - : section }) + return await Promise.iter((await ast) + // post handlers... + .map(function(section){ + return typeof(section) == 'function' ? + // NOTE: this can produce promises... + section.call(page, state) + : section })) .flat() // filters... // XXX if one of the post-handlers is a promise this will diff --git a/pwiki2-test.js b/pwiki2-test.js index 3e96da9..6749258 100755 --- a/pwiki2-test.js +++ b/pwiki2-test.js @@ -71,6 +71,14 @@ pwiki.pwiki Included quoted text: --- + --- + + Quote filters: + --- + + test filters... + + --- `, }) .update({