mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 11:00:08 +00:00 
			
		
		
		
	now <page>.each() understands strict mode...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									f31a040db5
								
							
						
					
					
						commit
						5abc20d57b
					
				| @ -582,8 +582,15 @@ object.Constructor('BasePage', { | |||||||
| 	// 			.energetic
 | 	// 			.energetic
 | ||||||
| 	// 			.store.isEnergetic(..)
 | 	// 			.store.isEnergetic(..)
 | ||||||
| 	// 			.resolve(..) -> .store.resolve(..)
 | 	// 			.resolve(..) -> .store.resolve(..)
 | ||||||
| 	each: function(path){ | 	// XXX should this support strict mode???
 | ||||||
|  | 	each: function(path, strict){ | ||||||
| 		var that = this | 		var that = this | ||||||
|  | 		// XXX STRICT...
 | ||||||
|  | 		if(path === true || path === false){ | ||||||
|  | 			strict = path | ||||||
|  | 			path = null } | ||||||
|  | 		strict = strict  | ||||||
|  | 			?? this.strict | ||||||
| 		// NOTE: we are trying to avoid resolving non-pattern paths unless 
 | 		// NOTE: we are trying to avoid resolving non-pattern paths unless 
 | ||||||
| 		// 		we really have to...
 | 		// 		we really have to...
 | ||||||
| 		path = path ? | 		path = path ? | ||||||
| @ -608,7 +615,18 @@ object.Constructor('BasePage', { | |||||||
| 		return Promise.iter( | 		return Promise.iter( | ||||||
| 			paths, | 			paths, | ||||||
| 			function(path){ | 			function(path){ | ||||||
|  | 				// XXX STRICT...
 | ||||||
|  | 				return strict ? | ||||||
|  | 					Promise.awaitOrRun( | ||||||
|  | 						that.exists('/'+path), | ||||||
|  | 						function(exists){ | ||||||
|  | 							return exists ? | ||||||
|  | 								that.get('/'+ path) | ||||||
|  | 								: [] }) | ||||||
|  | 					: that.get('/'+ path) }) | ||||||
|  | 				/*/ // XXX STRICT...
 | ||||||
| 				return that.get('/'+ path) }) | 				return that.get('/'+ path) }) | ||||||
|  | 				//*/
 | ||||||
| 			.sync() }, | 			.sync() }, | ||||||
| 	/*/ // XXX ASYNC...
 | 	/*/ // XXX ASYNC...
 | ||||||
| 	each: async function*(path){ | 	each: async function*(path){ | ||||||
| @ -1586,6 +1604,7 @@ object.Constructor('Page', BasePage, { | |||||||
| 		// 				@macro(src="./resolved-page" else="no" text="yes" strict)
 | 		// 				@macro(src="./resolved-page" else="no" text="yes" strict)
 | ||||||
| 		// 					-> yes
 | 		// 					-> yes
 | ||||||
| 		// 			should be "no"
 | 		// 			should be "no"
 | ||||||
|  | 		// 			...this seems to effect non-pattern pages...
 | ||||||
| 		// XXX should macro:index be 0 or 1 (current) based???
 | 		// XXX should macro:index be 0 or 1 (current) based???
 | ||||||
| 		// XXX SORT sorting not implemented yet...
 | 		// XXX SORT sorting not implemented yet...
 | ||||||
| 		macro: Macro( | 		macro: Macro( | ||||||
| @ -1705,6 +1724,7 @@ object.Constructor('Page', BasePage, { | |||||||
| 						&& await base.parse(join, state) | 						&& await base.parse(join, state) | ||||||
| 
 | 
 | ||||||
| 					//var match = this.get(await base.parse(src, state))
 | 					//var match = this.get(await base.parse(src, state))
 | ||||||
|  | 					//var match = this.get(src, strict)
 | ||||||
| 					var match = this.get(src) | 					var match = this.get(src) | ||||||
| 
 | 
 | ||||||
| 					// NOTE: thie does not introduce a dependency on each 
 | 					// NOTE: thie does not introduce a dependency on each 
 | ||||||
| @ -2493,6 +2513,9 @@ module.System = { | |||||||
| 							oninput="saveContent(\'@source(s ./path)/title\', this.innerText)"> | 							oninput="saveContent(\'@source(s ./path)/title\', this.innerText)"> | ||||||
| 						@source(./title/quote) | 						@source(./title/quote) | ||||||
| 					</span> | 					</span> | ||||||
|  | 					@macro(src="." strict  | ||||||
|  | 						text="" | ||||||
|  | 						else="<sup>*</sup>") | ||||||
| 				</h1> | 				</h1> | ||||||
| 			</macro> | 			</macro> | ||||||
| 			<macro texteditor> | 			<macro texteditor> | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user