mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 01:50:07 +00:00
experimenting + notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b575aaf784
commit
dd5a9496a2
@ -436,17 +436,27 @@ module.BaseParser = {
|
|||||||
// XXX macros: we are mixing up ast state and parse state...
|
// XXX macros: we are mixing up ast state and parse state...
|
||||||
// one should only be used for parsing and be forgotten after
|
// one should only be used for parsing and be forgotten after
|
||||||
// the ast is constructed the other should be part of the ast...
|
// the ast is constructed the other should be part of the ast...
|
||||||
|
// XXX ASYNC...
|
||||||
expand: async function*(page, ast, state={}){
|
expand: async function*(page, ast, state={}){
|
||||||
|
/*/
|
||||||
|
expand: function*(page, ast, state={}){
|
||||||
|
//*/
|
||||||
try{
|
try{
|
||||||
ast = ast == null ?
|
ast = ast == null ?
|
||||||
//this.group(page)
|
// XXX ASYNC...
|
||||||
this.group(page, await page.raw ?? '')
|
this.group(page, await page.raw ?? '')
|
||||||
|
/*/
|
||||||
|
page.raw
|
||||||
|
.then(function(raw){
|
||||||
|
return this.group(page, raw ?? '') })
|
||||||
|
//*/
|
||||||
: typeof(ast) != 'object' ?
|
: typeof(ast) != 'object' ?
|
||||||
this.group(page, ast)
|
this.group(page, ast)
|
||||||
: ast instanceof types.Generator ?
|
: ast instanceof types.Generator ?
|
||||||
ast
|
ast
|
||||||
: ast.iter()
|
: ast.iter()
|
||||||
|
|
||||||
|
//XXX ASYNC need to .awaitOrRun(ast, ...)...
|
||||||
while(true){
|
while(true){
|
||||||
var {value, done} = ast.next()
|
var {value, done} = ast.next()
|
||||||
if(done){
|
if(done){
|
||||||
@ -464,6 +474,7 @@ module.BaseParser = {
|
|||||||
yield {...value, skip: true}
|
yield {...value, skip: true}
|
||||||
continue }
|
continue }
|
||||||
|
|
||||||
|
// XXX ASYNC...
|
||||||
var res =
|
var res =
|
||||||
await this.callMacro(page, name, args, body, state)
|
await this.callMacro(page, name, args, body, state)
|
||||||
?? ''
|
?? ''
|
||||||
@ -474,6 +485,17 @@ module.BaseParser = {
|
|||||||
yield* res
|
yield* res
|
||||||
} else {
|
} else {
|
||||||
yield res } }
|
yield res } }
|
||||||
|
/*/
|
||||||
|
yield* Promise.awaitOrRun(
|
||||||
|
this.callMacro(page, name, args, body, state),
|
||||||
|
function*(res){
|
||||||
|
res = res ?? ''
|
||||||
|
if(res instanceof Array
|
||||||
|
|| page.macros[name] instanceof types.Generator){
|
||||||
|
yield* res
|
||||||
|
} else {
|
||||||
|
yield res } })
|
||||||
|
//*/
|
||||||
|
|
||||||
// error...
|
// error...
|
||||||
}catch(err){
|
}catch(err){
|
||||||
|
|||||||
@ -38,6 +38,8 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
* XXX ASAP need to add error handling to .awaitOrRun(..)
|
||||||
|
* ...might be even better to make it support the same interface as Promise...
|
||||||
* XXX BUG: seems that page caching stopped working...
|
* XXX BUG: seems that page caching stopped working...
|
||||||
* ...are we over-refreshing???
|
* ...are we over-refreshing???
|
||||||
* XXX BUG: for some reason editing the root page ('/') hangs /tree...
|
* XXX BUG: for some reason editing the root page ('/') hangs /tree...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user