mirror of
https://github.com/flynx/pWiki.git
synced 2026-01-05 17:41:14 +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???
|
// XXX should this also resolve e.data???
|
||||||
resolve: async function*(page, ast, state={}){
|
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
|
// NOTE: we need to await for ast here as we need stage 2 of
|
||||||
// parsing to happen AFTER everything else completes...
|
// 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){
|
for(var e of await ast){
|
||||||
|
//*/
|
||||||
e = typeof(e) == 'function' ?
|
e = typeof(e) == 'function' ?
|
||||||
e.call(page, state)
|
e.call(page, state)
|
||||||
: e
|
: e
|
||||||
|
|
||||||
// expand arrays...
|
// expand arrays...
|
||||||
if(e instanceof Array){
|
if(e instanceof Array
|
||||||
|
| e instanceof types.Generator){
|
||||||
yield* this.resolve(page, e, state)
|
yield* this.resolve(page, e, state)
|
||||||
// data -- unwrap content...
|
// data -- unwrap content...
|
||||||
} else if(e instanceof Object && 'data' in e){
|
} else if(e instanceof Object && 'data' in e){
|
||||||
@ -487,12 +499,6 @@ module.BaseParser = {
|
|||||||
// XXX add a special filter to clear pending filters... (???)
|
// XXX add a special filter to clear pending filters... (???)
|
||||||
parse: async function(page, ast, state={}){
|
parse: async function(page, ast, state={}){
|
||||||
var that = this
|
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)
|
return await this.resolve(page, ast, state)
|
||||||
// filters...
|
// filters...
|
||||||
.map(function(section){
|
.map(function(section){
|
||||||
|
|||||||
11
pwiki2.js
11
pwiki2.js
@ -8,9 +8,14 @@
|
|||||||
* 1) the rendering infrastructure to support generation and
|
* 1) the rendering infrastructure to support generation and
|
||||||
* partial rendering starting from .expand(..) and up...
|
* partial rendering starting from .expand(..) and up...
|
||||||
* input output
|
* input output
|
||||||
* .expand(..) DONE
|
* .expand(..) DONE DONE
|
||||||
* .resolve(..)
|
* .resolve(..) partial DONE
|
||||||
* .parse(..)
|
* 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:
|
* 2) all the macros that can source pages to produce generators:
|
||||||
* @include(..) -- DONE
|
* @include(..) -- DONE
|
||||||
* @source(..) -- DONE
|
* @source(..) -- DONE
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user