mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 10:00:08 +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...
|
||||
// one should only be used for parsing and be forgotten after
|
||||
// the ast is constructed the other should be part of the ast...
|
||||
// XXX ASYNC...
|
||||
expand: async function*(page, ast, state={}){
|
||||
/*/
|
||||
expand: function*(page, ast, state={}){
|
||||
//*/
|
||||
try{
|
||||
ast = ast == null ?
|
||||
//this.group(page)
|
||||
// XXX ASYNC...
|
||||
this.group(page, await page.raw ?? '')
|
||||
/*/
|
||||
page.raw
|
||||
.then(function(raw){
|
||||
return this.group(page, raw ?? '') })
|
||||
//*/
|
||||
: typeof(ast) != 'object' ?
|
||||
this.group(page, ast)
|
||||
: ast instanceof types.Generator ?
|
||||
ast
|
||||
: ast.iter()
|
||||
|
||||
//XXX ASYNC need to .awaitOrRun(ast, ...)...
|
||||
while(true){
|
||||
var {value, done} = ast.next()
|
||||
if(done){
|
||||
@ -464,6 +474,7 @@ module.BaseParser = {
|
||||
yield {...value, skip: true}
|
||||
continue }
|
||||
|
||||
// XXX ASYNC...
|
||||
var res =
|
||||
await this.callMacro(page, name, args, body, state)
|
||||
?? ''
|
||||
@ -474,6 +485,17 @@ module.BaseParser = {
|
||||
yield* res
|
||||
} else {
|
||||
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...
|
||||
}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...
|
||||
* ...are we over-refreshing???
|
||||
* XXX BUG: for some reason editing the root page ('/') hangs /tree...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user