X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=public%2Findex.js;h=7c5a82c24043d6d5da63e41c3dfb5b1b631bd4aa;hb=904fc60f05894d6207e9ae85abda8c94283f7d28;hp=f60e8a82201ca222e90e0f3b5882069860e76ec6;hpb=313af3c2bd347bbea8b58c34f6c2c2a8f0a56b87;p=mdref%2Fmdref diff --git a/public/index.js b/public/index.js index f60e8a8..7c5a82c 100644 --- a/public/index.js +++ b/public/index.js @@ -97,8 +97,12 @@ $(function() { return ""; } } - if (-1 !== (j = s.indexOf("\\")) && s.substr(j+1,1) !== "n") { - return ""; + if (-1 !== (j = s.lastIndexOf("\\")) && s.substr(j+1,1) !== "n") { + t = s.substring(j+1); + if (!mdref.is_constant(t) || s.match(/\\/).length <= 1) { + return ""; + } + return ""; } switch (s.toLowerCase()) { @@ -126,7 +130,7 @@ $(function() { $n.text().split(/([^a-zA-Z0-9_\\\$:]+)/).forEach(function(v) { var t; - if ((t = mdref.type(v, nn))) { + if ((t = mdref.type(v.replace(/:$/, ""), nn))) { a.push($(t).text(v)); } else if (a.length && a[a.length-1].nodeName === "#text") { /* if we already have a text node and the next is also gonna be a text