-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcriticmarkup.min.js
1 lines (1 loc) · 1.22 KB
/
criticmarkup.min.js
1
var CriticMarkup={toHTML:function(e){return e.replace(/\{\-\-([\s\S]*?)\-\-[ \t]*(\[([\s\S]*?)\])?[ \t]*\}/gm,function(e,t){var n="";if(t.match(/^(\r\n|\n|\r)/)&&!t.match(/^(\r\n|\n|\r)$/)){n="\n\n<del> </del>\n\n";n=n+"<del>"+t.replace(/(\r\n|\n|\r)/," ");n=n+"</del>"}else if(t.match(/^(\r\n|\n|\r)$/)){n=n+"\n\n<del> </del>\n\n"}else{n="<del>"+t.replace(/^(\r\n|\n|\r)/," ")+"</del>"}return n}).replace(/\{\+\+([\s\S]*?)\+\+[ \t]*(\[([\s\S]*?)\])?[ \t]*\}/gm,function(e,t){var n="";if(t.match(/^(\r\n|\n|\r)/)&&!t.match(/^(\r\n|\n|\r)$/)){n="\n\n<ins> </ins>\n\n";n=n+"<ins>"+t.replace(/(\r\n|\n|\r)/," ");n=n+"</ins>"}else if(t.match(/^(\r\n|\n|\r)$/)){n=n+"\n\n<ins> </ins>\n\n"}else{n="<ins>"+t.replace(/^(\r\n|\n|\r)/," ")+"</ins>"}return n}).replace(/\{\=\=([\s\S]*?)\=\=\}\{\>\>([\s\S]*?)\<\<\}/gm,function(e,t,n){return"<mark>"+t+'</mark><span class="critic comment">'+n.replace(/(\r\n|\n|\r)/," ")+"</span>"}).replace(/\{\>\>([\s\S]*?)\<\<\}/gm,function(e,t){return'<span class="critic comment">'+t.replace(/^(\r\n|\n|\r)/," ")+"</span>"}).replace(/\{\~\~([\s\S](?:[^\~\>]|(?:\~(?!\>)))*)\~\>([\s\S](?:[^\~\~]|(?:\~(?!\~\})))*)\~\~\}/gm,function(e,t,n){var r="<del>"+t+"</del>";var i="<ins>"+n+"</ins>";return r+i})}}