From 382c3f4350f3440215d1695e4bc394072615eae6 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 5 Jul 2026 12:39:52 +0300 Subject: [PATCH] minor fix... Signed-off-by: Alex A. Naanou --- v3/pwiki/parser.js | 15 ++++++++------- v3/pwiki/test/parser.js | 6 +++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/v3/pwiki/parser.js b/v3/pwiki/parser.js index f985685..7209e8e 100644 --- a/v3/pwiki/parser.js +++ b/v3/pwiki/parser.js @@ -1371,15 +1371,16 @@ module.parser = { // get and run things... return Promise.awaitOrRun( page.get(src).matched, - // XXX push this to a later stage -- we might not even need it... - page.get(src).raw, function(paths, texts){ - paths = paths instanceof Array ? - paths - : [paths] - texts = texts instanceof Array ? - texts + texts = + // special case: list page... + paths.length == 1 + && texts instanceof Array ? + [texts] + : texts instanceof Array ? + texts : [texts] + return Promise.awaitOrRun( // handle pages... Promise diff --git a/v3/pwiki/test/parser.js b/v3/pwiki/test/parser.js index 7ad83ab..99200dc 100755 --- a/v3/pwiki/test/parser.js +++ b/v3/pwiki/test/parser.js @@ -87,7 +87,11 @@ module.exports.P = { return res.length == 1 ? res[0] - : res }, + // if at least one page is a promise wait for all... + : Promise + .iter(res) + .sync() }, + // res }, // XXX should this return an arrya for a multi-match??? get text(){