tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-10-20 19:07:57 +03:00
parent ab9d2ead09
commit bf31acf2b5

View File

@ -556,20 +556,24 @@ var symbols = {
'/!\\': '⚠', '/!\\': '⚠',
}, },
get symbols_pattern(){ get symbols_pattern(){
return new RegExp(`(?<!\\\\)(${ return (this.symbols != null
Object.keys(this.symbols) && Object.keys(this.symbols).length > 0) ?
.join('|') new RegExp(`(?<!\\\\)(${
.replace(/([\(\)\\\/])/g, '\\$1') Object.keys(this.symbols)
})`, 'g') }, .join('|')
.replace(/([\(\)\\\/])/g, '\\$1') })`, 'g')
: undefined },
__parse__: function(text, editor, elem){ __parse__: function(text, editor, elem){
var that = this var that = this
return text var p = this.symbols_pattern
//* XXX text = p ?
.replace(this.symbols_pattern, text.replace(p,
function(m){ function(m){
return that.symbols[m] }) return that.symbols[m] })
/*/ : text
return text
/* XXX
.replace(/(?<!\\)>>/gm, '»') .replace(/(?<!\\)>>/gm, '»')
.replace(/(?<!\\)<</gm, '«') .replace(/(?<!\\)<</gm, '«')
.replace(/(?<![\\<])->/gm, '→') .replace(/(?<![\\<])->/gm, '→')