mirror of
https://github.com/flynx/pWiki.git
synced 2026-08-24 08:16:43 +00:00
removed stray .wait when there is nothing to wait for...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
c411414212
commit
c3523fe9b4
@ -842,13 +842,14 @@ module.BaseParser = {
|
|||||||
// are the responsibility of the respective macros...
|
// are the responsibility of the respective macros...
|
||||||
elems.push(elem) }
|
elems.push(elem) }
|
||||||
|
|
||||||
var resolving =
|
if(unresolved.length > 0){
|
||||||
state.wait =
|
var resolving =
|
||||||
Promise.all([state.wait, ...unresolved])
|
state.wait =
|
||||||
// cleanup...
|
Promise.all([state.wait, ...unresolved])
|
||||||
.then(function(){
|
// cleanup...
|
||||||
if(state.wait === resolving){
|
.then(function(){
|
||||||
delete state.wait } })
|
if(state.wait === resolving){
|
||||||
|
delete state.wait } }) }
|
||||||
|
|
||||||
return elems },
|
return elems },
|
||||||
|
|
||||||
@ -871,10 +872,12 @@ module.BaseParser = {
|
|||||||
// - apply stage III post handlers
|
// - apply stage III post handlers
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
// XXX BUG: this seems to always return a promise...
|
||||||
// XXX RECURSION might be a good idea to limit recursion/nesting depth
|
// XXX RECURSION might be a good idea to limit recursion/nesting depth
|
||||||
// of inner resolve(..)...
|
// of inner resolve(..)...
|
||||||
// XXX RENAME...
|
// XXX RENAME...
|
||||||
finalize: function(page, ast, state={}, nested_handlers={}, wait='wait'){
|
finalize: function(page, ast, state={}, nested_handlers={}, wait='wait'){
|
||||||
|
//finalize: function(page, ast, state={}, nested_handlers={}, wait='waitNested'){
|
||||||
var that = this
|
var that = this
|
||||||
|
|
||||||
var stage3 = function(ast){
|
var stage3 = function(ast){
|
||||||
@ -912,7 +915,7 @@ module.BaseParser = {
|
|||||||
// XXX do we actually need to wait here???
|
// XXX do we actually need to wait here???
|
||||||
// ...each macro should already be waiting...
|
// ...each macro should already be waiting...
|
||||||
//...[state[wait]].flat(),
|
//...[state[wait]].flat(),
|
||||||
state.hasOwnProperty(wait) ?
|
(wait && state.hasOwnProperty(wait)) ?
|
||||||
state[wait]
|
state[wait]
|
||||||
: null,
|
: null,
|
||||||
function(){
|
function(){
|
||||||
@ -922,9 +925,9 @@ module.BaseParser = {
|
|||||||
return Promise.awaitOrRun(
|
return Promise.awaitOrRun(
|
||||||
// XXX LOCAL_STATE if we are nested we should not wait
|
// XXX LOCAL_STATE if we are nested we should not wait
|
||||||
// for anything after the caller...
|
// for anything after the caller...
|
||||||
!that.isResolved(ast) ?
|
that.isResolved(ast) ?
|
||||||
resolve(ast)
|
ast
|
||||||
: ast,
|
: resolve(ast),
|
||||||
function(ast){
|
function(ast){
|
||||||
return (
|
return (
|
||||||
// stage III post...
|
// stage III post...
|
||||||
@ -1046,7 +1049,8 @@ module.parser = {
|
|||||||
// | -<filter> <filter-spec>
|
// | -<filter> <filter-spec>
|
||||||
//
|
//
|
||||||
// XXX BUG why is the 2nd filter a promise????
|
// XXX BUG why is the 2nd filter a promise????
|
||||||
// '<filter upper/>aaa <filter -upper> moo </filter> bbb'
|
// '<filter upper/>aaa <filter -upper> moo </filter> bbb'
|
||||||
|
// -> error in .finalize(..)???
|
||||||
// XXX should we include the global filters (current) or exclude
|
// XXX should we include the global filters (current) or exclude
|
||||||
// them by default???
|
// them by default???
|
||||||
// XXX BUG: async body breaks nested filters...
|
// XXX BUG: async body breaks nested filters...
|
||||||
@ -1085,7 +1089,7 @@ module.parser = {
|
|||||||
page,
|
page,
|
||||||
body,
|
body,
|
||||||
{
|
{
|
||||||
...state,
|
__proto__: state,
|
||||||
filters: clear ?
|
filters: clear ?
|
||||||
filters
|
filters
|
||||||
: [...filters, ...state.filters ?? []],
|
: [...filters, ...state.filters ?? []],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user