From cb4778d6c4b00e767726ec7e6801c3ff52b4ec91 Mon Sep 17 00:00:00 2001
From: joyqi "+this.markLine(n,r)+d(t.join("\n"))+"
"}return t},e.prototype.parse=function(t,e,n){var r,s,l,i,o,a,c,h,p,u;for(null==e&&(e=!1),null==n&&(n=0),a=[],r=this.parseBlock(t,a),l="",e&&1===r.length&&"normal"===r[0][0]&&(r[0][3]=!0),i=0,o=r.length;i"+d(t[3])+"
")}))).replace(/(^|[^\\])(\$+)(.+?)\2/gm,(l=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+l.makeHolder(t[2]+d(t[3])+t[2])}))).replace(/\\(.)/g,(i=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=t[1].match(/^[-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]$/)?"":"\\",t=d(t[1]);return t=t.replace(/\$/g,"$"),i.makeHolder(e+t)}))).replace(/<(https?:\/\/.+|(?:mailto:)?[_a-z0-9-\.\+]+@[_\w-]+\.[a-z]{2,})>/gi,(o=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=o.cleanUrl(t[1]),t=o.call("parseLink",e);return o.makeHolder(''+t+"")}))).replace(/<(\/?)([a-z0-9-]+)(\s+[^>]*)?>/gi,(a=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return a.html||0<=("|"+a.commonWhiteList+"|"+e+"|").indexOf("|"+t[2].toLowerCase()+"|")?a.makeHolder(t[0]):a.makeHolder(d(t[0]))})),this.html&&(t=t.replace(//g,(c=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return c.makeHolder(t[0])}))),t=(t=(t=(t=(t=(t=g(["<",">"],["<",">"],t)).replace(/\[\^((?:[^\]]|\\\]|\\\[)+?)\]/g,(h=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=h.footnotes.indexOf(t[1]);return e<0&&(e=h.footnotes.length+1,h.footnotes.push(h.parseInline(t[1],"",!1))),h.makeHolder(''+e+"")}))).replace(/!\[((?:[^\]]|\\\]|\\\[)*?)\]\(((?:[^\)]|\\\)|\\\()+?)\)/g,(p=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=d(p.escapeBracket(t[1])),n=p.escapeBracket(t[2]),t=p.cleanUrl(n,!0);return n=t[0],t=null==(t=t[1])?e:' title="'+t+'"',p.makeHolder('')}))).replace(/!\[((?:[^\]]|\\\]|\\\[)*?)\]\[((?:[^\]]|\\\]|\\\[)+?)\]/g,(u=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=d(u.escapeBracket(t[1])),e=null!=u.definitions[t[2]]?'':e;return u.makeHolder(e)}))).replace(/\[((?:[^\]]|\\\]|\\\[)+?)\]\(((?:[^\)]|\\\)|\\\()+?)\)/g,(f=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=f.parseInline(f.escapeBracket(t[1]),"",!1,!1),n=f.escapeBracket(t[2]),t=f.cleanUrl(n,!0);return n=t[0],t=null==(t=t[1])?"":' title="'+t+'"',f.makeHolder('"+e+"")}))).replace(/\[((?:[^\]]|\\\]|\\\[)+?)\]\[((?:[^\]]|\\\]|\\\[)+?)\]/g,(k=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=k.parseInline(k.escapeBracket(t[1]),"",!1,!1),e=null!=k.definitions[t[2]]?''+e+"":e;return k.makeHolder(e)})),t=this.parseInlineCallback(t),r&&(t=t.replace(/(^|[^\"])(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*)|(?:mailto:)?[_a-z0-9-\.\+]+@[_\w-]+\.[a-z]{2,})($|[^\"])/g,(m=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=m.cleanUrl(t[2]),e=m.call("parseLink",e);return t[1]+''+t[2]+""+t[5]}))),t=this.call("afterParseInlineBeforeRelease",t),t=this.releaseHolder(t,n),t=this.call("afterParseInline",t)},e.prototype.parseInlineCallback=function(t){var e,n,r,s,l,i,o;return t=(t=(t=(t=(t=(t=(t=t.replace(/(\*{3})((?:.|\r)+?)\1/gm,(e=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+e.parseInlineCallback(t[2])+""}))).replace(/(\*{2})((?:.|\r)+?)\1/gm,(n=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+n.parseInlineCallback(t[2])+""}))).replace(/(\*)((?:.|\r)+?)\1/gm,(r=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+r.parseInlineCallback(t[2])+""}))).replace(/(\s+|^)(_{3})((?:.|\r)+?)\2(\s+|$)/gm,(s=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+""+s.parseInlineCallback(t[3])+""+t[4]}))).replace(/(\s+|^)(_{2})((?:.|\r)+?)\2(\s+|$)/gm,(l=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+""+l.parseInlineCallback(t[3])+""+t[4]}))).replace(/(\s+|^)(_)((?:.|\r)+?)\2(\s+|$)/gm,(i=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+""+i.parseInlineCallback(t[3])+""+t[4]}))).replace(/(~{2})((?:.|\r)+?)\1/gm,(o=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+o.parseInlineCallback(t[2])+""}))},e.prototype.parseBlock=function(t,e){for(var n,r,s,l,i,o,a,c,h,p=t.split("\n"),u=0,f=p.length;u
"},e.prototype.parsePre=function(t,e,n){return t=t.map(function(t){return d(t.substring(4))}),(n=this.markLines(t,n).join("\n")).match(/^\s*$/)?"":""+n+"
"},e.prototype.parseAhtml=function(t,e,n){return $(this.markLines(t,n).join("\n"))},e.prototype.parseShtml=function(t,e,n){return $(this.markLines(t.slice(1,-1),n+1).join("\n"))},e.prototype.parseMath=function(t,e,n,r){return""+n+"
"+this.parse(t,!0,n)+"
"},e.prototype.parseList=function(t,e,n){for(var r,s,l,i,o,a,c="",h=e[0],p=e[1],u=e[2],f=[],k="",m=0,d=r=0,g=t.length;r",r)c=(u=r[y])[0],f=u[1],g+="<"+(u=d?"th":"td"),1 ",d?g+="":B=B&&!1}return null!==B&&(g+=""),g+""},e.prototype.parseHr=function(t,e,n){return this.line?'
':"
"},e.prototype.parseNormal=function(t,e,n){var r,s=0;return t=t.map((r=this,function(t){return(t=r.parseInline(t)).match(/^\s*$/)||(t=r.markLine(n+s)+t),s+=1,t})),(t=(t=(t=$(t.join("\n"))).replace(/(\n\s*){2,}/g,function(){return e=!1,"
"})).replace(/\n/g,"
")).match(/^\s*$/)?"":e?t:"
"+t+"
"},e.prototype.parseFootnote=function(t,e){e[0];var e=e[1],e=this.footnotes.indexOf(e);return 0<=e&&((t=t.slice(0))[0]=t[0].replace(/^\[\^((?:[^\]]|\]|\[)+?)\]:/,""),this.footnotes[e]=t),""},e.prototype.parseDefinition=function(){return""},e.prototype.parseHtml=function(t,e,n){var r;return t=t.map((r=this,function(t){return r.parseInline(t,null!=r.specialWhiteList[e]?r.specialWhiteList[e]:"")})),this.markLines(t,n).join("\n")},e.prototype.cleanUrl=function(t,e){var n,r;return null==e&&(e=!1),r=null,e&&0<(n=t.indexOf(" "))&&(r=d($(t.substring(n+1)," \"'")),t=t.substring(0,n)),(n=(t=t.replace(/["'<>\s]/g,"")).match(/^(mailto:)?[_a-z0-9-\.\+]+@[_\w-]+\.[a-z]{2,}$/i))&&null==n[1]&&(t="mailto:"+t),t.match(/^\w+:/i)&&!t.match(/^(https?|mailto):/i)?"#":e?[t,r]:t},e.prototype.escapeBracket=function(t){return g(["\\[","\\]","\\(","\\)"],["[","]","(",")"],t)},e.prototype.startBlock=function(t,e,n){return null==n&&(n=null),this.pos+=1,this.current=t,this.blocks.push([t,e,e,n]),this},e.prototype.endBlock=function(){return this.current="normal",this},e.prototype.isBlock=function(t,e){return null==e&&(e=null),this.current===t&&(null===e||this.blocks[this.pos][3]===e)},e.prototype.getBlock=function(){return null!=this.blocks[this.pos]?this.blocks[this.pos]:null},e.prototype.setBlock=function(t,e){return null==t&&(t=null),null==e&&(e=null),null!==t&&(this.blocks[this.pos][2]=t),null!==e&&(this.blocks[this.pos][3]=e),this},e.prototype.backBlock=function(t,e,n){var r;return null==n&&(n=null),this.pos<0?this.startBlock(e,0,n):(r=this.blocks[this.pos][2],this.blocks[this.pos][2]=r-t,n=[e,r-t+1,r,n],this.blocks[this.pos][1]<=this.blocks[this.pos][2]?(this.pos+=1,this.blocks.push(n)):this.blocks[this.pos]=n,this.current=e,this)},e.prototype.combineBlock=function(){var t,e;return this.pos<1||(e=this.blocks[this.pos-1].slice(0),t=this.blocks[this.pos].slice(0),e[2]=t[2],this.blocks[this.pos-1]=e,this.current=e[0],this.blocks=this.blocks.slice(0,-1),--this.pos),this},t=e,"undefined"!=typeof module&&null!==module?module.exports=t:"undefined"!=typeof window&&null!==window&&(window.HyperDown=t)}).call(this); \ No newline at end of file +(function(){var t,k,r,d,c,g,$,f,B=[].slice;function e(){this.commonWhiteList="kbd|b|i|strong|em|sup|sub|br|code|del|a|hr|small",this.blockHtmlTags="p|div|h[1-6]|blockquote|pre|table|dl|ol|ul|address|form|fieldset|iframe|hr|legend|article|section|nav|aside|hgroup|header|footer|figcaption|svg|script|noscript",this.specialWhiteList={table:"table|tbody|thead|tfoot|tr|td|th"},this.hooks={},this.html=!1,this.line=!1,this.blockParsers=[["code",10],["shtml",20],["pre",30],["ahtml",40],["shr",50],["list",60],["math",70],["html",80],["footnote",90],["definition",100],["quote",110],["table",120],["sh",130],["mh",140],["dhr",150],["default",9999]],this.parsers={}}f=function(t){return t.charAt(0).toUpperCase()+t.substring(1)},c=function(t){return t.replace(/[-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},g=function(t,e,n){var r,s,l,i,o,a;if(t instanceof Array)if(e instanceof Array)for(r=s=0,i=t.length;s/g,">").replace(/"/g,""")},$=function(t,e){var n,r,s,l,i;if(null==e&&(e=null),null==e)return t.replace(/^\s*/,"").replace(/\s*$/,"");for(i="",r=s=0,l=e.length-1;0<=l?s<=l:l<=s;r=0<=l?++s:--s)n=e[r],i+=c(n);return i="["+i+"]*",t.replace(new RegExp("^"+i),"").replace(new RegExp(i+"$"),"")},k=function(t){var e,n,r,s=[];if(t instanceof Array)for(n=e=0,r=t.length;e"+d(t[3])+"
")}))).replace(/(^|[^\\])(\$+)(.+?)\2/gm,(l=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+l.makeHolder(t[2]+d(t[3])+t[2])}))).replace(/\\(.)/g,(i=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=t[1].match(/^[-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]$/)?"":"\\",t=d(t[1]);return t=t.replace(/\$/g,"$"),i.makeHolder(e+t)}))).replace(/<(https?:\/\/.+|(?:mailto:)?[_a-z0-9-\.\+]+@[_\w-]+\.[a-z]{2,})>/gi,(o=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=o.cleanUrl(t[1]),t=o.call("parseLink",e);return o.makeHolder(''+t+"")}))).replace(/<(\/?)([a-z0-9-]+)(\s+[^>]*)?>/gi,(a=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return a.html||0<=("|"+a.commonWhiteList+"|"+e+"|").indexOf("|"+t[2].toLowerCase()+"|")?a.makeHolder(t[0]):a.makeHolder(d(t[0]))})),this.html&&(t=t.replace(//g,(c=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return c.makeHolder(t[0])}))),t=(t=(t=(t=(t=(t=g(["<",">"],["<",">"],t)).replace(/\[\^((?:[^\]]|\\\]|\\\[)+?)\]/g,(h=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=h.footnotes.indexOf(t[1]);return e<0&&(e=h.footnotes.length+1,h.footnotes.push(h.parseInline(t[1],"",!1))),h.makeHolder(''+e+"")}))).replace(/!\[((?:[^\]]|\\\]|\\\[)*?)\]\(((?:[^\)]|\\\)|\\\()+?)\)/g,(p=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=d(p.escapeBracket(t[1])),n=p.escapeBracket(t[2]),t=p.cleanUrl(n,!0);return n=t[0],t=null==(t=t[1])?e:' title="'+t+'"',p.makeHolder('')}))).replace(/!\[((?:[^\]]|\\\]|\\\[)*?)\]\[((?:[^\]]|\\\]|\\\[)+?)\]/g,(u=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=d(u.escapeBracket(t[1])),e=null!=u.definitions[t[2]]?'':e;return u.makeHolder(e)}))).replace(/\[((?:[^\]]|\\\]|\\\[)+?)\]\(((?:[^\)]|\\\)|\\\()+?)\)/g,(f=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=f.parseInline(f.escapeBracket(t[1]),"",!1,!1),n=f.escapeBracket(t[2]),t=f.cleanUrl(n,!0);return n=t[0],t=null==(t=t[1])?"":' title="'+t+'"',f.makeHolder('"+e+"")}))).replace(/\[((?:[^\]]|\\\]|\\\[)+?)\]\[((?:[^\]]|\\\]|\\\[)+?)\]/g,(k=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=k.parseInline(k.escapeBracket(t[1]),"",!1,!1),e=null!=k.definitions[t[2]]?''+e+"":e;return k.makeHolder(e)})),t=this.parseInlineCallback(t),r&&(t=t.replace(/(^|[^\"])(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*)|(?:mailto:)?[_a-z0-9-\.\+]+@[_\w-]+\.[a-z]{2,})($|[^\"])/g,(m=this,function(){var t=1<=arguments.length?B.call(arguments,0):[],e=m.cleanUrl(t[2]),n=m.call("parseLink",e);return t[1]+''+n+""+t[5]}))),t=this.call("afterParseInlineBeforeRelease",t),t=this.releaseHolder(t,n),t=this.call("afterParseInline",t)},e.prototype.parseInlineCallback=function(t){var e,n,r,s,l,i,o;return t=(t=(t=(t=(t=(t=(t=t.replace(/(\*{3})((?:.|\r)+?)\1/gm,(e=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+e.parseInlineCallback(t[2])+""}))).replace(/(\*{2})((?:.|\r)+?)\1/gm,(n=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+n.parseInlineCallback(t[2])+""}))).replace(/(\*)((?:.|\r)+?)\1/gm,(r=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+r.parseInlineCallback(t[2])+""}))).replace(/(\s+|^)(_{3})((?:.|\r)+?)\2(\s+|$)/gm,(s=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+""+s.parseInlineCallback(t[3])+""+t[4]}))).replace(/(\s+|^)(_{2})((?:.|\r)+?)\2(\s+|$)/gm,(l=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+""+l.parseInlineCallback(t[3])+""+t[4]}))).replace(/(\s+|^)(_)((?:.|\r)+?)\2(\s+|$)/gm,(i=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return t[1]+""+i.parseInlineCallback(t[3])+""+t[4]}))).replace(/(~{2})((?:.|\r)+?)\1/gm,(o=this,function(){var t=1<=arguments.length?B.call(arguments,0):[];return""+n+"
"},e.prototype.parsePre=function(t,e,n){return t=t.map(function(t){return d(t.substring(4))}),(n=this.markLines(t,n).join("\n")).match(/^\s*$/)?"":""+n+"
"},e.prototype.parseAhtml=function(t,e,n){return $(this.markLines(t,n).join("\n"))},e.prototype.parseShtml=function(t,e,n){return $(this.markLines(t.slice(1,-1),n+1).join("\n"))},e.prototype.parseMath=function(t,e,n,r){return""+this.markLine(n,r)+d(t.join("\n"))+"
"},e.prototype.parseSh=function(t,e,n,r){t=this.markLine(n,r)+this.parseInline($(t[0],"# "));return t.match(/^\s*$/)?"":""+this.parse(t,!0,n)+""},e.prototype.parseList=function(t,e,n){for(var r,s,l,i,o,a,c="",h=e[0],p=e[1],u=e[2],f=[],k="",m=0,d=r=0,g=t.length;r
"})).replace(/\n/g,"
")).match(/^\s*$/)?"":e?t:"
"+t+"
"},e.prototype.parseFootnote=function(t,e){e[0];var e=e[1],e=this.footnotes.indexOf(e);return 0<=e&&((t=t.slice(0))[0]=t[0].replace(/^\[\^((?:[^\]]|\]|\[)+?)\]:/,""),this.footnotes[e]=t),""},e.prototype.parseDefinition=function(){return""},e.prototype.parseHtml=function(t,e,n){var r;return t=t.map((r=this,function(t){return r.parseInline(t,null!=r.specialWhiteList[e]?r.specialWhiteList[e]:"")})),this.markLines(t,n).join("\n")},e.prototype.cleanUrl=function(t,e){var n,r;return null==e&&(e=!1),r=null,e&&0<(n=t.indexOf(" "))&&(r=d($(t.substring(n+1)," \"'")),t=t.substring(0,n)),(n=(t=t.replace(/["'<>\s]/g,"")).match(/^(mailto:)?[_a-z0-9-\.\+]+@[_\w-]+\.[a-z]{2,}$/i))&&null==n[1]&&(t="mailto:"+t),t.match(/^\w+:/i)&&!t.match(/^(https?|mailto):/i)?"#":e?[t,r]:t},e.prototype.escapeBracket=function(t){return g(["\\[","\\]","\\(","\\)"],["[","]","(",")"],t)},e.prototype.startBlock=function(t,e,n){return null==n&&(n=null),this.pos+=1,this.current=t,this.blocks.push([t,e,e,n]),this},e.prototype.endBlock=function(){return this.current="normal",this},e.prototype.isBlock=function(t,e){return null==e&&(e=null),this.current===t&&(null===e||this.blocks[this.pos][3]===e)},e.prototype.getBlock=function(){return null!=this.blocks[this.pos]?this.blocks[this.pos]:null},e.prototype.setBlock=function(t,e){return null==t&&(t=null),null==e&&(e=null),null!==t&&(this.blocks[this.pos][2]=t),null!==e&&(this.blocks[this.pos][3]=e),this},e.prototype.backBlock=function(t,e,n){var r;return null==n&&(n=null),this.pos<0?this.startBlock(e,0,n):(r=this.blocks[this.pos][2],this.blocks[this.pos][2]=r-t,n=[e,r-t+1,r,n],this.blocks[this.pos][1]<=this.blocks[this.pos][2]?(this.pos+=1,this.blocks.push(n)):this.blocks[this.pos]=n,this.current=e,this)},e.prototype.combineBlock=function(){var t,e;return this.pos<1||(e=this.blocks[this.pos-1].slice(0),t=this.blocks[this.pos].slice(0),e[2]=t[2],this.blocks[this.pos-1]=e,this.current=e[0],this.blocks=this.blocks.slice(0,-1),--this.pos),this},t=e,"undefined"!=typeof module&&null!==module?module.exports=t:"undefined"!=typeof window&&null!==window&&(window.HyperDown=t)}).call(this); \ No newline at end of file diff --git a/admin/src/js/hyperdown.js b/admin/src/js/hyperdown.js index 841c82fc..796b7eac 100644 --- a/admin/src/js/hyperdown.js +++ b/admin/src/js/hyperdown.js @@ -413,7 +413,7 @@ matches = 1 <= arguments.length ? slice.call(arguments, 0) : []; url = _this.cleanUrl(matches[2]); link = _this.call('parseLink', url); - return matches[1] + "" + matches[2] + "" + matches[5]; + return matches[1] + "" + link + "" + matches[5]; }; })(this)); } diff --git a/var/HyperDown.php b/var/HyperDown.php index 67bf7fba..d587b783 100644 --- a/var/HyperDown.php +++ b/var/HyperDown.php @@ -545,7 +545,7 @@ class HyperDown function ($matches) use ($self) { $url = $self->cleanUrl($matches[2]); $link = $self->call('parseLink', $url); - return "{$matches[1]}{$matches[2]}{$matches[5]}"; + return "{$matches[1]}{$link}{$matches[5]}"; }, $text );