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
							
								
									436bf6ffae
								
							
						
					
					
						commit
						df7b74f1a3
					
				| @ -538,16 +538,48 @@ var styling = { | ||||
| 
 | ||||
| // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -      
 | ||||
| 
 | ||||
| // 
 | ||||
| // XXX use ligatures for these???
 | ||||
| var symbols = { | ||||
| 	__proto__: plugin, | ||||
| 
 | ||||
| 	// XXX use a single regex with handler func to do these...
 | ||||
| 	symbols: { | ||||
| 			'>>': '»',  | ||||
| 			'<<': '«',  | ||||
| 			'->': '→',  | ||||
| 			'<-': '←',  | ||||
| 			'=>': '⇒',  | ||||
| 			'<=': '⇐',  | ||||
| 			'(i)': '🛈',  | ||||
| 			'(c)': '©',  | ||||
| 			'/!\\': '⚠',  | ||||
| 	}, | ||||
| 	get symbols_pattern(){ | ||||
| 		return new RegExp(`(?<!\\\\)(${  | ||||
| 			Object.keys(this.symbols) | ||||
| 				.join('|')  | ||||
| 					.replace(/([\(\)\\\/])/g, '\\$1') | ||||
| 		})`, 'g') },
 | ||||
| 
 | ||||
| 	__parse__: function(text, editor, elem){ | ||||
| 		var that = this | ||||
| 		return text | ||||
| 			.replace(this.symbols_pattern,  | ||||
| 				function(m){ | ||||
| 					return that.symbols[m] }) | ||||
| 			// characters...
 | ||||
| 			/* | ||||
| 			.replace(/(?<!\\)>>/gm, '»')  | ||||
| 			.replace(/(?<!\\)<</gm, '«')  | ||||
| 			.replace(/(?<![\\<])->/gm, '→')  | ||||
| 			.replace(/(?<![\\<])=>/gm, '⇒')  | ||||
| 			.replace(/(?<!\\)<-(?!>)/gm, '←')  | ||||
| 			.replace(/(?<!\\)<=(?!>)/gm, '⇐')  | ||||
| 			.replace(/(?<!\\)\(i\)/gm, '🛈')  | ||||
| 			.replace(/(?<!\\)\(c\)/gm, '©')  | ||||
| 			.replace(/(?<!\\)\/!\\/gm, '⚠')  | ||||
| 			//*/
 | ||||
| 			.replace(/(?<!\\)---(?!-)/gm, '—')  | ||||
| 			.replace(/(?<!\\)--(?!-)/gm, '–') }, | ||||
| } | ||||
|  | ||||
| @ -261,6 +261,7 @@ var setup = function(){ | ||||
|         | 11 | 22 | 33 | | ||||
|     - Symbols -- _should these be ligatures?_ | ||||
|       - (i), (c), /!\, ... | ||||
| 	  - <-, ->, <=, =>, <<, >> _(not sure about these)_ | ||||
| 	  - -- and --- | ||||
|     -  | ||||
|   - --- | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user