mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 02:50:08 +00:00 
			
		
		
		
	several bugfixes + founc new bug...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									6c5b088dd5
								
							
						
					
					
						commit
						2c8f0bd59e
					
				
							
								
								
									
										40
									
								
								pwiki2.js
									
									
									
									
									
								
							
							
						
						
									
										40
									
								
								pwiki2.js
									
									
									
									
									
								
							| @ -21,9 +21,9 @@ | |||||||
| * 	- an async REPL??? | * 	- an async REPL??? | ||||||
| * | * | ||||||
| * | * | ||||||
| * XXX BUG: .get('/* /path').raw will return a punch of '/*' copies, should  | * XXX BUG: macro is broken... | ||||||
| * 		be the same as .get('/*').match()... | * 		this will fail: | ||||||
| * 		(NOTE: the " " in the pattern is to avoid closing the block comment) | * 			p.pwiki.parse('<macro src="/test/*">@source(./path)</macro>') | ||||||
| * | * | ||||||
| * | * | ||||||
| * | * | ||||||
| @ -272,7 +272,8 @@ object.Constructor('BasePage', { | |||||||
| 	// page data...
 | 	// page data...
 | ||||||
| 	//
 | 	//
 | ||||||
| 	strict: undefined, | 	strict: undefined, | ||||||
| 	get data(){ | 	get data(){ return (async function(){ | ||||||
|  | 		var that = this | ||||||
| 		// NOTE: we need to make sure each page gets the chance to handle 
 | 		// NOTE: we need to make sure each page gets the chance to handle 
 | ||||||
| 		// 		its context....
 | 		// 		its context....
 | ||||||
| 		if(this.isPattern){ | 		if(this.isPattern){ | ||||||
| @ -280,10 +281,10 @@ object.Constructor('BasePage', { | |||||||
| 				.map(function(page){ | 				.map(function(page){ | ||||||
| 					return page.data }) } | 					return page.data }) } | ||||||
| 		// single page...
 | 		// single page...
 | ||||||
| 		var res = this.store.get(this.location, !!this.strict) | 		var res = await this.store.get(this.location, !!this.strict) | ||||||
| 		return typeof(res) == 'function' ? | 		return typeof(res) == 'function' ? | ||||||
| 			res.bind(this) | 			res.bind(this) | ||||||
| 			: res }, | 			: res }).call(this) }, | ||||||
| 		//return this.store.get(this.location, !!this.strict) },
 | 		//return this.store.get(this.location, !!this.strict) },
 | ||||||
| 	set data(value){ | 	set data(value){ | ||||||
| 		this.__update__(value) }, | 		this.__update__(value) }, | ||||||
| @ -1563,28 +1564,6 @@ object.Constructor('Page', BasePage, { | |||||||
| 	// NOTE: when matching multiple pages this will return a list...
 | 	// NOTE: when matching multiple pages this will return a list...
 | ||||||
| 	get raw(){ return (async function(){ | 	get raw(){ return (async function(){ | ||||||
| 		var that = this | 		var that = this | ||||||
| 
 |  | ||||||
| 		var pages = await this.each() |  | ||||||
| 			.map(async function(page){ |  | ||||||
| 				var data = await page.data |  | ||||||
| 				return ( |  | ||||||
| 					// action...
 |  | ||||||
| 					typeof(data) == 'function' ? |  | ||||||
| 						data.call(page) |  | ||||||
| 						: data.text ) }) |  | ||||||
| 
 |  | ||||||
| 		if(pages.length == 0){ |  | ||||||
| 			var msg = (this.PAGE_NOT_FOUND  |  | ||||||
| 					|| module.PAGE_NOT_FOUND) |  | ||||||
| 				.replace(/\$PATH/, this.path) |  | ||||||
| 			if(this.PAGE_NOT_FOUND){ |  | ||||||
| 				return msg } |  | ||||||
| 			throw new Error(msg) } |  | ||||||
| 
 |  | ||||||
| 		return this.isPattern ? |  | ||||||
| 			pages |  | ||||||
| 			: pages[0] }).call(this) }, |  | ||||||
| 	/*/ |  | ||||||
| 		var data = await this.data | 		var data = await this.data | ||||||
| 		// no data...
 | 		// no data...
 | ||||||
| 		// NOTE: if we hit this it means that nothing was resolved, 
 | 		// NOTE: if we hit this it means that nothing was resolved, 
 | ||||||
| @ -1601,17 +1580,16 @@ object.Constructor('Page', BasePage, { | |||||||
| 		return ( | 		return ( | ||||||
| 			// action...
 | 			// action...
 | ||||||
| 			typeof(data) == 'function' ? | 			typeof(data) == 'function' ? | ||||||
| 				data.call(this) | 				data() | ||||||
| 			// multiple matches...
 | 			// multiple matches...
 | ||||||
| 			: data instanceof Array ? | 			: data instanceof Array ? | ||||||
| 				data | 				data | ||||||
| 					.map(function(d){ | 					.map(function(d){ | ||||||
| 						return typeof(d) == 'function'? | 						return typeof(d) == 'function'? | ||||||
| 							d.call(that) | 							d() | ||||||
| 							: d.text }) | 							: d.text }) | ||||||
| 					.flat() | 					.flat() | ||||||
|    			: data.text )}).call(this) }, |    			: data.text )}).call(this) }, | ||||||
| 	//*/
 |  | ||||||
| 	set raw(value){ | 	set raw(value){ | ||||||
| 		this.__update__({text: value}) }, | 		this.__update__({text: value}) }, | ||||||
| 		//this.onTextUpdate(value) },
 | 		//this.onTextUpdate(value) },
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user