mirror of
				https://github.com/flynx/pWiki.git
				synced 2025-10-30 18:40: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???
 | // XXX use ligatures for these???
 | ||||||
| var symbols = { | var symbols = { | ||||||
| 	__proto__: plugin, | 	__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){ | 	__parse__: function(text, editor, elem){ | ||||||
|  | 		var that = this | ||||||
| 		return text | 		return text | ||||||
|  | 			.replace(this.symbols_pattern,  | ||||||
|  | 				function(m){ | ||||||
|  | 					return that.symbols[m] }) | ||||||
| 			// characters...
 | 			// characters...
 | ||||||
|  | 			/* | ||||||
|  | 			.replace(/(?<!\\)>>/gm, '»')  | ||||||
|  | 			.replace(/(?<!\\)<</gm, '«')  | ||||||
|  | 			.replace(/(?<![\\<])->/gm, '→')  | ||||||
|  | 			.replace(/(?<![\\<])=>/gm, '⇒')  | ||||||
|  | 			.replace(/(?<!\\)<-(?!>)/gm, '←')  | ||||||
|  | 			.replace(/(?<!\\)<=(?!>)/gm, '⇐')  | ||||||
| 			.replace(/(?<!\\)\(i\)/gm, '🛈')  | 			.replace(/(?<!\\)\(i\)/gm, '🛈')  | ||||||
| 			.replace(/(?<!\\)\(c\)/gm, '©')  | 			.replace(/(?<!\\)\(c\)/gm, '©')  | ||||||
| 			.replace(/(?<!\\)\/!\\/gm, '⚠')  | 			.replace(/(?<!\\)\/!\\/gm, '⚠')  | ||||||
|  | 			//*/
 | ||||||
| 			.replace(/(?<!\\)---(?!-)/gm, '—')  | 			.replace(/(?<!\\)---(?!-)/gm, '—')  | ||||||
| 			.replace(/(?<!\\)--(?!-)/gm, '–') }, | 			.replace(/(?<!\\)--(?!-)/gm, '–') }, | ||||||
| } | } | ||||||
|  | |||||||
| @ -261,7 +261,8 @@ var setup = function(){ | |||||||
|         | 11 | 22 | 33 | |         | 11 | 22 | 33 | | ||||||
|     - Symbols -- _should these be ligatures?_ |     - Symbols -- _should these be ligatures?_ | ||||||
|       - (i), (c), /!\, ... |       - (i), (c), /!\, ... | ||||||
|       - -- and --- | 	  - <-, ->, <=, =>, <<, >> _(not sure about these)_ | ||||||
|  | 	  - -- and --- | ||||||
|     -  |     -  | ||||||
|   - --- |   - --- | ||||||
|   - ### Playground for testing |   - ### Playground for testing | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user