mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 02:50:08 +00:00 
			
		
		
		
	tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									5b93c36f58
								
							
						
					
					
						commit
						e9a70040af
					
				
							
								
								
									
										13
									
								
								pwiki2.js
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								pwiki2.js
									
									
									
									
									
								
							| @ -253,6 +253,8 @@ module.store = { | |||||||
| 	//
 | 	//
 | ||||||
| 	// XXX should these return this or the data???
 | 	// XXX should these return this or the data???
 | ||||||
| 	// XXX FUNC handle functions as pages...
 | 	// XXX FUNC handle functions as pages...
 | ||||||
|  | 	// XXX BUG: for path '/' this adds an entry at '', but when getting 
 | ||||||
|  | 	// 		'/', the later is not found...
 | ||||||
| 	update: function(path, data, mode='update'){ | 	update: function(path, data, mode='update'){ | ||||||
| 		path = module.path.normalize('/'+ path, 'string') | 		path = module.path.normalize('/'+ path, 'string') | ||||||
| 		path = path[path.length-1] == '/' ? | 		path = path[path.length-1] == '/' ? | ||||||
| @ -1044,13 +1046,15 @@ object.Constructor('Page', BasePage, { | |||||||
| 			if(name){ | 			if(name){ | ||||||
| 				// define new named macro...
 | 				// define new named macro...
 | ||||||
| 				if(text){ | 				if(text){ | ||||||
| 					state.macros[name] = text | 					;(state.macros = state.macros ?? {})[name] = text | ||||||
| 				// use existing macro...
 | 				// use existing macro...
 | ||||||
| 				} else if(name in state.macros){ | 				} else if(state.macros  | ||||||
|  | 						&& name in state.macros){ | ||||||
| 					text = state.macros[name] } } | 					text = state.macros[name] } } | ||||||
| 
 | 
 | ||||||
| 			if(src){ | 			if(src){ | ||||||
| 				var pages = this.get(src).each() | 				var pages = this.get(src).each() | ||||||
|  | 				console.log('---', pages.length) | ||||||
| 				// no matching pages -> get the else block...
 | 				// no matching pages -> get the else block...
 | ||||||
| 				if(pages.length == 0 && text){ | 				if(pages.length == 0 && text){ | ||||||
| 					// XXX get the else block...
 | 					// XXX get the else block...
 | ||||||
| @ -1058,15 +1062,16 @@ object.Constructor('Page', BasePage, { | |||||||
| 						.filter(function(e){  | 						.filter(function(e){  | ||||||
| 							return typeof(e) != 'string'  | 							return typeof(e) != 'string'  | ||||||
| 								&& e.name == 'else' })  | 								&& e.name == 'else' })  | ||||||
|  | 					if(else_block.length == 0){ | ||||||
|  | 						return } | ||||||
| 					// XXX do we take the first or the last (now) block???
 | 					// XXX do we take the first or the last (now) block???
 | ||||||
| 					else_block = else_block.pop() | 					else_block = else_block.pop() | ||||||
| 					else_block =  | 					else_block =  | ||||||
| 						else_block.args.text  | 						else_block.args.text  | ||||||
| 							?? else_block.body | 							?? else_block.body | ||||||
| 					console.log('---', else_block) |  | ||||||
| 					return else_block ? | 					return else_block ? | ||||||
| 						this.__parser__.expand(this, else_block, state) | 						this.__parser__.expand(this, else_block, state) | ||||||
| 						: '' } | 						: undefined } | ||||||
| 
 | 
 | ||||||
| 				// sort pages...
 | 				// sort pages...
 | ||||||
| 				if(sort.length > 0){ | 				if(sort.length > 0){ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user