mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 11:00:08 +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???
 | 	// 		or render as any other page???
 | ||||||
| 	// 		...currently they are rendered in the context of the page and
 | 	// 		...currently they are rendered in the context of the page and
 | ||||||
| 	// 		not in their own context...
 | 	// 		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(){ | 	get text(){ | ||||||
|  | 		return Promise.awaitOrRun( | ||||||
|  | 			!this.strict | ||||||
|  | 				|| this.resolve(true), | ||||||
|  | 			function(exists){ | ||||||
| 				// strict mode -- break on non-existing pages...
 | 				// strict mode -- break on non-existing pages...
 | ||||||
| 		if(this.strict  | 				if(!exists){ | ||||||
| 				// XXX
 |  | ||||||
| 				&& !await this.resolve(true)){ |  | ||||||
| 					throw new Error('NOT FOUND ERROR: '+ this.location) } | 					throw new Error('NOT FOUND ERROR: '+ this.location) } | ||||||
| 
 | 
 | ||||||
| 				var path = pwpath.split(this.path) | 				var path = pwpath.split(this.path) | ||||||
| @ -2035,7 +2041,7 @@ object.Constructor('Page', BasePage, { | |||||||
| 						var depends = this.depends = new Set([tpl]) | 						var depends = this.depends = new Set([tpl]) | ||||||
| 						// do the parse...
 | 						// do the parse...
 | ||||||
| 						// NOTE: we render the template in context of page...
 | 						// NOTE: we render the template in context of page...
 | ||||||
| 				return that | 						return this | ||||||
| 							// NOTE: this.path can both contain a template and not, this
 | 							// NOTE: this.path can both contain a template and not, this
 | ||||||
| 							// 		normalizes it to the path up to the template path...
 | 							// 		normalizes it to the path up to the template path...
 | ||||||
| 							.get(path, {args: this.args}) | 							.get(path, {args: this.args}) | ||||||
| @ -2046,7 +2052,7 @@ object.Constructor('Page', BasePage, { | |||||||
| 								{ | 								{ | ||||||
| 									depends,  | 									depends,  | ||||||
| 									renderer: this, | 									renderer: this, | ||||||
| 						}) }.bind(this)) }, | 								}) }.bind(this)) }.bind(this)) }, | ||||||
| 	/*/ // XXX ASYNC
 | 	/*/ // XXX ASYNC
 | ||||||
| 	get text(){ return (async function(){ | 	get text(){ return (async function(){ | ||||||
| 		// strict mode -- break on non-existing pages...
 | 		// strict mode -- break on non-existing pages...
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user