mirror of
https://github.com/flynx/pWiki.git
synced 2026-07-10 18:40:56 +00:00
moved recursion testing back -- diffrent macros may will need to control this differently...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b98e4ca5c0
commit
9341e45346
@ -1313,18 +1313,7 @@ module.parser = {
|
||||
// content handler...
|
||||
handler ??=
|
||||
function(page, body, path, text, state){
|
||||
return args.isolated ?
|
||||
this.resolve(
|
||||
page,
|
||||
text,
|
||||
args.isolated == 'partial' ?
|
||||
serialize.partialDeepCopy(state)
|
||||
: {})
|
||||
: this.expand(page, text, state) }
|
||||
|
||||
var pageHandler =
|
||||
function([path, text]){
|
||||
// recursion...
|
||||
// check for recursion...
|
||||
// XXX for some reason this does not work for async...
|
||||
// ...and works quite differently in tests and
|
||||
// in console -- returns [object Object] in the
|
||||
@ -1336,24 +1325,39 @@ module.parser = {
|
||||
return that.expand(page, recursive, state) }
|
||||
include_stack.push(path)
|
||||
|
||||
// XXX cache???
|
||||
// XXX check cache???
|
||||
|
||||
// call the handler...
|
||||
var res = args.isolated ?
|
||||
this.resolve(
|
||||
page,
|
||||
text,
|
||||
Object.assign(
|
||||
args.isolated == 'partial' ?
|
||||
serialize.partialDeepCopy(state)
|
||||
: {},
|
||||
{include_stack}))
|
||||
: this.expand(page, text, state)
|
||||
|
||||
// handle recursion...
|
||||
return Promise.awaitOrRun(
|
||||
res,
|
||||
function(){
|
||||
state.include_stack.at(-1) == src
|
||||
&& state.include_stack.pop()
|
||||
// cleanup...
|
||||
if(state.include_stack.length == 0){
|
||||
delete state.include_stack
|
||||
delete state.recursive }
|
||||
|
||||
return res }) }
|
||||
|
||||
var pageHandler =
|
||||
function([path, text]){
|
||||
// handle nested promises...
|
||||
return Promise.awaitOrRun(
|
||||
text,
|
||||
function(text){
|
||||
return Promise.awaitOrRun(
|
||||
handler.call(that, page, body, path, text, state),
|
||||
function(res){
|
||||
// recursion
|
||||
state.include_stack.at(-1) == src
|
||||
&& state.include_stack.pop()
|
||||
// cleanup...
|
||||
if(state.include_stack.length == 0){
|
||||
delete state.include_stack
|
||||
delete state.recursive }
|
||||
|
||||
return res }) }) }
|
||||
return handler.call(that, page, body, path, text, state) }) }
|
||||
|
||||
// get and run things...
|
||||
return Promise.awaitOrRun(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user