mirror of
https://github.com/flynx/pWiki.git
synced 2025-11-02 03:50:10 +00:00
refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7a1956b760
commit
416e3e7bde
@ -2009,12 +2009,18 @@ object.Constructor('Page', BasePage, {
|
||||
// or render as any other page???
|
||||
// ...currently they are rendered in the context of the page and
|
||||
// not in their own context...
|
||||
/*/ XXX revise how we handle strict mode...
|
||||
// XXX revise how we handle strict mode...
|
||||
//
|
||||
// XXX EXPERIMENTAL
|
||||
// XXX would be nice to be able to chain .awaitOrRun(..) calls instead
|
||||
// of nesting them like here...
|
||||
get text(){
|
||||
return Promise.awaitOrRun(
|
||||
!this.strict
|
||||
|| this.resolve(true),
|
||||
function(exists){
|
||||
// strict mode -- break on non-existing pages...
|
||||
if(this.strict
|
||||
// XXX
|
||||
&& !await this.resolve(true)){
|
||||
if(!exists){
|
||||
throw new Error('NOT FOUND ERROR: '+ this.location) }
|
||||
|
||||
var path = pwpath.split(this.path)
|
||||
@ -2035,7 +2041,7 @@ object.Constructor('Page', BasePage, {
|
||||
var depends = this.depends = new Set([tpl])
|
||||
// do the parse...
|
||||
// NOTE: we render the template in context of page...
|
||||
return that
|
||||
return this
|
||||
// NOTE: this.path can both contain a template and not, this
|
||||
// normalizes it to the path up to the template path...
|
||||
.get(path, {args: this.args})
|
||||
@ -2046,7 +2052,7 @@ object.Constructor('Page', BasePage, {
|
||||
{
|
||||
depends,
|
||||
renderer: this,
|
||||
}) }.bind(this)) },
|
||||
}) }.bind(this)) }.bind(this)) },
|
||||
/*/ // XXX ASYNC
|
||||
get text(){ return (async function(){
|
||||
// strict mode -- break on non-existing pages...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user