mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-31 19:10:08 +00:00 
			
		
		
		
	refactoring and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									9348afd5c8
								
							
						
					
					
						commit
						78af3300c2
					
				| @ -1210,6 +1210,7 @@ var JSONOutline = { | ||||
| 	// XXX add plugin hooks...
 | ||||
| 	// XXX add option to customize indent size...
 | ||||
| 	text: function(node, indent, level){ | ||||
| 		var that = this | ||||
| 		// .text(<indent>, <level>)
 | ||||
| 		if(typeof(node) == 'string'){ | ||||
| 			;[node, indent='  ', level=''] = [undefined, ...arguments] } | ||||
| @ -1225,8 +1226,7 @@ var JSONOutline = { | ||||
| 					// attrs... 
 | ||||
| 					+ (Object.keys(elem) | ||||
| 						.reduce(function(res, attr){ | ||||
| 							return (attr == 'text'  | ||||
| 									|| attr == 'children') ? | ||||
| 							return that.__system_attrs__.includes(attr) ? | ||||
| 								res | ||||
| 								: res  | ||||
| 									+ (elem[attr] ? | ||||
| @ -1252,7 +1252,7 @@ var JSONOutline = { | ||||
| 		var attrs = [] | ||||
| 
 | ||||
| 		for(var [attr, value] of Object.entries({...data, ...parsed})){ | ||||
| 			if(attr == 'children' || attr == 'text'){ | ||||
| 			if(this.__system_attrs__.includes(attr)){ | ||||
| 				continue } | ||||
| 			var i | ||||
| 			var type = this.__block_attrs__[attr] | ||||
| @ -1675,9 +1675,13 @@ var Outline = { | ||||
| 			//this._syncTextSize(code, html) }
 | ||||
| 
 | ||||
| 		for(var [attr, value] of Object.entries({...data, ...parsed})){ | ||||
| 			if(attr == 'children' || attr == 'text'){ | ||||
| 			if(this.__system_attrs__.includes(attr)){ | ||||
| 				continue } | ||||
| 
 | ||||
| 			// quoted value...
 | ||||
| 			if(value && /^\s*([`'"])([^\1]*)\1\s*$/.test(value)){ | ||||
| 				value = value.replace(/^\s*([`'"])([^\1]*)\1\s*$/, '$2') } | ||||
| 
 | ||||
| 			var type = this.__block_attrs__[attr] | ||||
| 			if(type == 'cls'){ | ||||
| 				value ? | ||||
| @ -1693,6 +1697,7 @@ var Outline = { | ||||
| 					: node.removeAttribute(attr)  | ||||
| 			// dataset...
 | ||||
| 			} else { | ||||
| 				// remove attr...
 | ||||
| 				if(value == null | ||||
| 						|| value == 'null' | ||||
| 						|| value == 'undefined'){ | ||||
|  | ||||
| @ -148,8 +148,9 @@ var setup = function(){ | ||||
|     attr::value | ||||
|     - DONE `.__parse_code__(..)`: add data attributes to code if missing... | ||||
|     - DONE do we need `.__code_attrs__` / `.__view_attrs__`??? -- YES | ||||
|     - handle attr delete correctly -- i.e. if shown attr removed from code -> delete attr... | ||||
|     - BUG? can't set `''` as attr value -- parser?? | ||||
|     - DONE delete attr from code -- by setting it to `"null"` or `"undefined"`... | ||||
|     - delete attr from code -- by removing it from attr list (when shown)... | ||||
|     - DONE BUG? can't set `''` as attr value -- parser?? | ||||
|   - TOC: tweaking: add args like depth, ... -- as attributes... | ||||
|   - TOC: should it be persistently generated as code and be serializable? | ||||
|   - simple use strategies: | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user