mirror of
https://github.com/flynx/pWiki.git
synced 2025-10-29 10:00:08 +00:00
resolved the .renderer issue...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9bdb6902b3
commit
c63cf9faba
@ -1306,6 +1306,9 @@ object.Constructor('Page', BasePage, {
|
||||
|
||||
// page parser...
|
||||
//
|
||||
// NOTE: .__debug_last_render_state is mainly exposed for introspection
|
||||
// and debugging, set comment it out to disable...
|
||||
//__debug_last_render_state: undefined,
|
||||
parse: async function(text, state){
|
||||
var that = this
|
||||
text = await text
|
||||
@ -1316,7 +1319,17 @@ object.Constructor('Page', BasePage, {
|
||||
state = text
|
||||
text = null }
|
||||
state = state ?? {}
|
||||
return this.__parser__.parse(this, text, state) },
|
||||
// this is here for debugging and introspection...
|
||||
'__debug_last_render_state' in this
|
||||
&& (this.__debug_last_render_state = state)
|
||||
// parse...
|
||||
return this.__parser__.parse(
|
||||
this.get('.', {
|
||||
renderer: this,
|
||||
args: this.args,
|
||||
}),
|
||||
text,
|
||||
state) },
|
||||
|
||||
// raw page text...
|
||||
//
|
||||
@ -1412,10 +1425,6 @@ object.Constructor('Page', BasePage, {
|
||||
// NOTE: writing to .raw is the same as writing to .text...
|
||||
//
|
||||
// XXX revise how we handle strict mode...
|
||||
//
|
||||
// NOTE: .__debug_last_render_state is mainly exposed for introspection
|
||||
// and debugging, set comment it out to disable...
|
||||
//__debug_last_render_state: undefined,
|
||||
get text(){ return (async function(){
|
||||
// strict mode -- break on non-existing pages...
|
||||
if(this.strict
|
||||
@ -1427,7 +1436,6 @@ object.Constructor('Page', BasePage, {
|
||||
|| path.push(this.PAGE_TEMPLATE)
|
||||
var tpl = pwpath.join(path)
|
||||
var tpl_name = path.pop()
|
||||
//path = pwpath.joinArgs(path, this.args)
|
||||
|
||||
// get the template relative to the top most pattern...
|
||||
tpl = await this.get(tpl).find(true)
|
||||
@ -1438,18 +1446,9 @@ object.Constructor('Page', BasePage, {
|
||||
// render template in context of page...
|
||||
var depends = this.depends = new Set([tpl])
|
||||
var state = {depends}
|
||||
// this is here for debugging and introspection...
|
||||
'__debug_last_render_state' in this
|
||||
&& (this.__debug_last_render_state = state)
|
||||
//var data = { renderer: this }
|
||||
var data = {
|
||||
renderer: this,
|
||||
args: this.args,
|
||||
}
|
||||
return this.get(path, data)
|
||||
.parse(
|
||||
this.get('/'+tpl, data).raw,
|
||||
state) }).call(this) },
|
||||
// do the parse...
|
||||
return this
|
||||
.parse(this.get('/'+tpl).raw, state) }).call(this) },
|
||||
set text(value){
|
||||
this.__update__({text: value}) },
|
||||
//this.onTextUpdate(value) },
|
||||
|
||||
20
pwiki2.js
20
pwiki2.js
@ -5,26 +5,6 @@
|
||||
* await pwiki.get('/path/testDirect:x:y:z').parse('@include(.:$ARGS)')
|
||||
* and:
|
||||
* await pwiki.get('/path/testDirect:x:y:z').text
|
||||
* XXX ARGS: should the arg locations in these be the same???
|
||||
* // root path: /System/testAction:a:b:c
|
||||
* await pwiki.get('/path/testDirect:x:y:z').raw
|
||||
* .args - x y z
|
||||
* .renderer.args - a b c (XXX seems logical)
|
||||
* .root.args - a b c
|
||||
* await pwiki.get('/path/testDirect:x:y:z').parse('@include(.:$ARGS)')
|
||||
* .args - x y z
|
||||
* .renderer.args - a b c (XXX odd)
|
||||
* .root.args - a b c
|
||||
* XXX should parse .get('.:$ARGS', {renderer: ...}) ???
|
||||
* ...or should it set/reset .renderer on this???
|
||||
* await pwiki.get('/path/testDirect:x:y:z').text
|
||||
* .args - x y z
|
||||
* .renderer.args - x y z (XXX logical)
|
||||
* .root.args - a b c
|
||||
* ...this essentially boils down to how .renderer is handled...
|
||||
* currently it is inherited and since all pages are clones of the
|
||||
* root page and the root is rendered it is always the .renderer
|
||||
* unless we explicitly reassign it (.text)
|
||||
* XXX CACHE need to explicitly prevent caching of some actions/pages...
|
||||
* XXX FEATURE tags and accompanying API...
|
||||
* - add tags to page -- macro/filter
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user