mirror of
https://github.com/flynx/pWiki.git
synced 2025-12-27 05:01:57 +00:00
tweaking and notes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f2bf23f0d9
commit
635a7c729d
@ -446,15 +446,27 @@ module.BaseParser = {
|
||||
//
|
||||
// XXX should this also resolve e.data???
|
||||
resolve: async function*(page, ast, state={}){
|
||||
ast = ast
|
||||
?? this.expand(page, null, state)
|
||||
ast = typeof(ast) == 'string' ?
|
||||
this.expand(page, ast, state)
|
||||
: ast
|
||||
|
||||
// NOTE: we need to await for ast here as we need stage 2 of
|
||||
// parsing to happen AFTER everything else completes...
|
||||
/* XXX GENERATOR -- this breaks /test_slots...
|
||||
// ...investigate the data flow...
|
||||
for await (var e of ast){
|
||||
/*/
|
||||
for(var e of await ast){
|
||||
//*/
|
||||
e = typeof(e) == 'function' ?
|
||||
e.call(page, state)
|
||||
: e
|
||||
|
||||
// expand arrays...
|
||||
if(e instanceof Array){
|
||||
if(e instanceof Array
|
||||
| e instanceof types.Generator){
|
||||
yield* this.resolve(page, e, state)
|
||||
// data -- unwrap content...
|
||||
} else if(e instanceof Object && 'data' in e){
|
||||
@ -487,12 +499,6 @@ module.BaseParser = {
|
||||
// XXX add a special filter to clear pending filters... (???)
|
||||
parse: async function(page, ast, state={}){
|
||||
var that = this
|
||||
ast = ast
|
||||
?? this.expand(page, null, state)
|
||||
ast = typeof(ast) == 'string' ?
|
||||
this.expand(page, ast, state)
|
||||
: ast
|
||||
|
||||
return await this.resolve(page, ast, state)
|
||||
// filters...
|
||||
.map(function(section){
|
||||
|
||||
11
pwiki2.js
11
pwiki2.js
@ -8,9 +8,14 @@
|
||||
* 1) the rendering infrastructure to support generation and
|
||||
* partial rendering starting from .expand(..) and up...
|
||||
* input output
|
||||
* .expand(..) DONE
|
||||
* .resolve(..)
|
||||
* .parse(..)
|
||||
* .expand(..) DONE DONE
|
||||
* .resolve(..) partial DONE
|
||||
* XXX for-await-of (vs. for-of-await) breaks things
|
||||
* (see: /test_slots, ..?)
|
||||
* .parse(..) DONE NO
|
||||
* XXX with the current implementation of filters
|
||||
* this can't work as a generator...
|
||||
* ...might be a good idea to make filters local only...
|
||||
* 2) all the macros that can source pages to produce generators:
|
||||
* @include(..) -- DONE
|
||||
* @source(..) -- DONE
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user