linkify-html
Advanced tools
Comparing version 4.0.0-beta.1 to 4.0.0-beta.2
@@ -1163,4 +1163,7 @@ var linkifyHtml = (function (linkify) { | ||
function linkifyHtml(str) { | ||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
function linkifyHtml(str, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
// `tokens` and `token` in this section refer to tokens generated by the | ||
@@ -1216,2 +1219,6 @@ // HTML parser, not linkify's parser | ||
if (_token.selfClosing) { | ||
link += ' /'; | ||
} | ||
link += '>'; | ||
@@ -1223,3 +1230,3 @@ linkified.push(link); | ||
case EndTag: | ||
linkified.push("</".concat(_token.tagName, ">")); | ||
linkified.push("</" + _token.tagName + ">"); | ||
break; | ||
@@ -1232,3 +1239,3 @@ | ||
case Comment: | ||
linkified.push("<!--".concat(escapeText(_token.chars), "-->")); | ||
linkified.push("<!--" + escapeText(_token.chars) + "-->"); | ||
break; | ||
@@ -1238,10 +1245,10 @@ | ||
{ | ||
var doctype = "<!DOCTYPE ".concat(_token.name); | ||
var doctype = "<!DOCTYPE " + _token.name; | ||
if (_token.publicIdentifier) { | ||
doctype += " PUBLIC \"".concat(_token.publicIdentifier, "\""); | ||
doctype += " PUBLIC \"" + _token.publicIdentifier + "\""; | ||
} | ||
if (_token.systemIdentifier) { | ||
doctype += " \"".concat(_token.systemIdentifier, "\""); | ||
doctype += " \"" + _token.systemIdentifier + "\""; | ||
} | ||
@@ -1335,3 +1342,3 @@ | ||
content = _ref.content; | ||
return "<".concat(tagName, " ").concat(attributesToString(attributes), ">").concat(escapeText(content), "</").concat(tagName, ">"); | ||
return "<" + tagName + " " + attributesToString(attributes) + ">" + escapeText(content) + "</" + tagName + ">"; | ||
} | ||
@@ -1352,3 +1359,3 @@ | ||
var val = attributes[attr] + ''; | ||
result.push("".concat(attr, "=\"").concat(escapeAttr(val), "\"")); | ||
result.push(attr + "=\"" + escapeAttr(val) + "\""); | ||
} | ||
@@ -1365,3 +1372,3 @@ | ||
var value = attrs[i][1] + ''; | ||
attrStrs.push("".concat(name, "=\"").concat(escapeAttr(value), "\"")); | ||
attrStrs.push(name + "=\"" + escapeAttr(value) + "\""); | ||
} | ||
@@ -1368,0 +1375,0 @@ |
@@ -1,1 +0,1 @@ | ||
var linkifyHtml=function(t){"use strict";function e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var i=e(t),n={amp:"&",gt:">",lt:"<",nbsp:" ",quot:'"'},o=/^#[xX]([A-Fa-f0-9]+)$/,s=/^#([0-9]+)$/,a=/^([A-Za-z0-9]+)$/,r=function(){function t(t){this.named=t}return t.prototype.parse=function(t){if(t){var e=t.match(o);return e?String.fromCharCode(parseInt(e[1],16)):(e=t.match(s))?String.fromCharCode(parseInt(e[1],10)):(e=t.match(a))?this.named[e[1]]||"&"+e[1]+";":void 0}},t}(),h=/[\t\n\f ]/,u=/[A-Za-z]/,c=/\r\n?/g;function p(t){return h.test(t)}function d(t){return u.test(t)}var f=function(){function t(t,e,i){void 0===i&&(i="precompile"),this.delegate=t,this.entityParser=e,this.mode=i,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var t=this.peek();if("<"!==t||this.isIgnoredEndTag()){if("precompile"===this.mode&&"\n"===t){var e=this.tagNameBuffer.toLowerCase();"pre"!==e&&"textarea"!==e||this.consume()}this.transitionTo("data"),this.delegate.beginData()}else this.transitionTo("tagOpen"),this.markTagStart(),this.consume()},data:function(){var t=this.peek(),e=this.tagNameBuffer;"<"!==t||this.isIgnoredEndTag()?"&"===t&&"script"!==e&&"style"!==e?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(t)):(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume())},tagOpen:function(){var t=this.consume();"!"===t?this.transitionTo("markupDeclarationOpen"):"/"===t?this.transitionTo("endTagOpen"):("@"===t||":"===t||d(t))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(t))},markupDeclarationOpen:function(){var t=this.consume();"-"===t&&"-"===this.peek()?(this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment()):"DOCTYPE"===t.toUpperCase()+this.input.substring(this.index,this.index+6).toUpperCase()&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.transitionTo("doctype"),this.delegate.beginDoctype&&this.delegate.beginDoctype())},doctype:function(){p(this.consume())&&this.transitionTo("beforeDoctypeName")},beforeDoctypeName:function(){var t=this.consume();p(t)||(this.transitionTo("doctypeName"),this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(t.toLowerCase()))},doctypeName:function(){var t=this.consume();p(t)?this.transitionTo("afterDoctypeName"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(t.toLowerCase())},afterDoctypeName:function(){var t=this.consume();if(!p(t))if(">"===t)this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData");else{var e=t.toUpperCase()+this.input.substring(this.index,this.index+5).toUpperCase(),i="PUBLIC"===e.toUpperCase(),n="SYSTEM"===e.toUpperCase();(i||n)&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume()),i?this.transitionTo("afterDoctypePublicKeyword"):n&&this.transitionTo("afterDoctypeSystemKeyword")}},afterDoctypePublicKeyword:function(){var t=this.peek();p(t)?(this.transitionTo("beforeDoctypePublicIdentifier"),this.consume()):'"'===t?(this.transitionTo("doctypePublicIdentifierDoubleQuoted"),this.consume()):"'"===t?(this.transitionTo("doctypePublicIdentifierSingleQuoted"),this.consume()):">"===t&&(this.consume(),this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},doctypePublicIdentifierDoubleQuoted:function(){var t=this.consume();'"'===t?this.transitionTo("afterDoctypePublicIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(t)},doctypePublicIdentifierSingleQuoted:function(){var t=this.consume();"'"===t?this.transitionTo("afterDoctypePublicIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(t)},afterDoctypePublicIdentifier:function(){var t=this.consume();p(t)?this.transitionTo("betweenDoctypePublicAndSystemIdentifiers"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===t?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===t&&this.transitionTo("doctypeSystemIdentifierSingleQuoted")},betweenDoctypePublicAndSystemIdentifiers:function(){var t=this.consume();p(t)||(">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===t?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===t&&this.transitionTo("doctypeSystemIdentifierSingleQuoted"))},doctypeSystemIdentifierDoubleQuoted:function(){var t=this.consume();'"'===t?this.transitionTo("afterDoctypeSystemIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(t)},doctypeSystemIdentifierSingleQuoted:function(){var t=this.consume();"'"===t?this.transitionTo("afterDoctypeSystemIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(t)},afterDoctypeSystemIdentifier:function(){var t=this.consume();p(t)||">"===t&&(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},commentStart:function(){var t=this.consume();"-"===t?this.transitionTo("commentStartDash"):">"===t?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData(t),this.transitionTo("comment"))},commentStartDash:function(){var t=this.consume();"-"===t?this.transitionTo("commentEnd"):">"===t?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("-"),this.transitionTo("comment"))},comment:function(){var t=this.consume();"-"===t?this.transitionTo("commentEndDash"):this.delegate.appendToCommentData(t)},commentEndDash:function(){var t=this.consume();"-"===t?this.transitionTo("commentEnd"):(this.delegate.appendToCommentData("-"+t),this.transitionTo("comment"))},commentEnd:function(){var t=this.consume();">"===t?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("--"+t),this.transitionTo("comment"))},tagName:function(){var t=this.consume();p(t)?this.transitionTo("beforeAttributeName"):"/"===t?this.transitionTo("selfClosingStartTag"):">"===t?(this.delegate.finishTag(),this.transitionTo("beforeData")):this.appendToTagName(t)},endTagName:function(){var t=this.consume();p(t)?(this.transitionTo("beforeAttributeName"),this.tagNameBuffer=""):"/"===t?(this.transitionTo("selfClosingStartTag"),this.tagNameBuffer=""):">"===t?(this.delegate.finishTag(),this.transitionTo("beforeData"),this.tagNameBuffer=""):this.appendToTagName(t)},beforeAttributeName:function(){var t=this.peek();p(t)?this.consume():"/"===t?(this.transitionTo("selfClosingStartTag"),this.consume()):">"===t?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):"="===t?(this.delegate.reportSyntaxError("attribute name cannot start with equals sign"),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(t)):(this.transitionTo("attributeName"),this.delegate.beginAttribute())},attributeName:function(){var t=this.peek();p(t)?(this.transitionTo("afterAttributeName"),this.consume()):"/"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===t?(this.transitionTo("beforeAttributeValue"),this.consume()):">"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):'"'===t||"'"===t||"<"===t?(this.delegate.reportSyntaxError(t+" is not a valid character within attribute names"),this.consume(),this.delegate.appendToAttributeName(t)):(this.consume(),this.delegate.appendToAttributeName(t))},afterAttributeName:function(){var t=this.peek();p(t)?this.consume():"/"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===t?(this.consume(),this.transitionTo("beforeAttributeValue")):">"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(t))},beforeAttributeValue:function(){var t=this.peek();p(t)?this.consume():'"'===t?(this.transitionTo("attributeValueDoubleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):"'"===t?(this.transitionTo("attributeValueSingleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):">"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.transitionTo("attributeValueUnquoted"),this.delegate.beginAttributeValue(!1),this.consume(),this.delegate.appendToAttributeValue(t))},attributeValueDoubleQuoted:function(){var t=this.consume();'"'===t?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===t?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(t)},attributeValueSingleQuoted:function(){var t=this.consume();"'"===t?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===t?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(t)},attributeValueUnquoted:function(){var t=this.peek();p(t)?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("beforeAttributeName")):"/"===t?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"&"===t?(this.consume(),this.delegate.appendToAttributeValue(this.consumeCharRef()||"&")):">"===t?(this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.consume(),this.delegate.appendToAttributeValue(t))},afterAttributeValueQuoted:function(){var t=this.peek();p(t)?(this.consume(),this.transitionTo("beforeAttributeName")):"/"===t?(this.consume(),this.transitionTo("selfClosingStartTag")):">"===t?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},selfClosingStartTag:function(){">"===this.peek()?(this.consume(),this.delegate.markTagAsSelfClosing(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},endTagOpen:function(){var t=this.consume();("@"===t||":"===t||d(t))&&(this.transitionTo("endTagName"),this.tagNameBuffer="",this.delegate.beginEndTag(),this.appendToTagName(t))}},this.reset()}return t.prototype.reset=function(){this.transitionTo("beforeData"),this.input="",this.tagNameBuffer="",this.index=0,this.line=1,this.column=0,this.delegate.reset()},t.prototype.transitionTo=function(t){this.state=t},t.prototype.tokenize=function(t){this.reset(),this.tokenizePart(t),this.tokenizeEOF()},t.prototype.tokenizePart=function(t){for(this.input+=function(t){return t.replace(c,"\n")}(t);this.index<this.input.length;){var e=this.states[this.state];if(void 0===e)throw new Error("unhandled state "+this.state);e.call(this)}},t.prototype.tokenizeEOF=function(){this.flushData()},t.prototype.flushData=function(){"data"===this.state&&(this.delegate.finishData(),this.transitionTo("beforeData"))},t.prototype.peek=function(){return this.input.charAt(this.index)},t.prototype.consume=function(){var t=this.peek();return this.index++,"\n"===t?(this.line++,this.column=0):this.column++,t},t.prototype.consumeCharRef=function(){var t=this.input.indexOf(";",this.index);if(-1!==t){var e=this.input.slice(this.index,t),i=this.entityParser.parse(e);if(i){for(var n=e.length;n;)this.consume(),n--;return this.consume(),i}}},t.prototype.markTagStart=function(){this.delegate.tagOpen()},t.prototype.appendToTagName=function(t){this.tagNameBuffer+=t,this.delegate.appendToTagName(t)},t.prototype.isIgnoredEndTag=function(){var t=this.tagNameBuffer;return"title"===t&&"</title>"!==this.input.substring(this.index,this.index+8)||"style"===t&&"</style>"!==this.input.substring(this.index,this.index+8)||"script"===t&&"<\/script>"!==this.input.substring(this.index,this.index+9)},t}(),l=function(){function t(t,e){void 0===e&&(e={}),this.options=e,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new f(this,t,e.mode),this._currentAttribute=void 0}return t.prototype.tokenize=function(t){return this.tokens=[],this.tokenizer.tokenize(t),this.tokens},t.prototype.tokenizePart=function(t){return this.tokens=[],this.tokenizer.tokenizePart(t),this.tokens},t.prototype.tokenizeEOF=function(){return this.tokens=[],this.tokenizer.tokenizeEOF(),this.tokens[0]},t.prototype.reset=function(){this.token=null,this.startLine=1,this.startColumn=0},t.prototype.current=function(){var t=this.token;if(null===t)throw new Error("token was unexpectedly null");if(0===arguments.length)return t;for(var e=0;e<arguments.length;e++)if(t.type===arguments[e])return t;throw new Error("token type was unexpectedly "+t.type)},t.prototype.push=function(t){this.token=t,this.tokens.push(t)},t.prototype.currentAttribute=function(){return this._currentAttribute},t.prototype.addLocInfo=function(){this.options.loc&&(this.current().loc={start:{line:this.startLine,column:this.startColumn},end:{line:this.tokenizer.line,column:this.tokenizer.column}}),this.startLine=this.tokenizer.line,this.startColumn=this.tokenizer.column},t.prototype.beginDoctype=function(){this.push({type:"Doctype",name:""})},t.prototype.appendToDoctypeName=function(t){this.current("Doctype").name+=t},t.prototype.appendToDoctypePublicIdentifier=function(t){var e=this.current("Doctype");void 0===e.publicIdentifier?e.publicIdentifier=t:e.publicIdentifier+=t},t.prototype.appendToDoctypeSystemIdentifier=function(t){var e=this.current("Doctype");void 0===e.systemIdentifier?e.systemIdentifier=t:e.systemIdentifier+=t},t.prototype.endDoctype=function(){this.addLocInfo()},t.prototype.beginData=function(){this.push({type:"Chars",chars:""})},t.prototype.appendToData=function(t){this.current("Chars").chars+=t},t.prototype.finishData=function(){this.addLocInfo()},t.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},t.prototype.appendToCommentData=function(t){this.current("Comment").chars+=t},t.prototype.finishComment=function(){this.addLocInfo()},t.prototype.tagOpen=function(){},t.prototype.beginStartTag=function(){this.push({type:"StartTag",tagName:"",attributes:[],selfClosing:!1})},t.prototype.beginEndTag=function(){this.push({type:"EndTag",tagName:""})},t.prototype.finishTag=function(){this.addLocInfo()},t.prototype.markTagAsSelfClosing=function(){this.current("StartTag").selfClosing=!0},t.prototype.appendToTagName=function(t){this.current("StartTag","EndTag").tagName+=t},t.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},t.prototype.appendToAttributeName=function(t){this.currentAttribute()[0]+=t},t.prototype.beginAttributeValue=function(t){this.currentAttribute()[2]=t},t.prototype.appendToAttributeValue=function(t){this.currentAttribute()[1]+=t},t.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},t.prototype.reportSyntaxError=function(t){this.current().syntaxError=t},t}();function m(t,e){return new l(new r(n),e).tokenize(t)}var g=i.Options,b="LinkifyResult",T="StartTag",y="EndTag",D="Chars",v="Comment",A="Doctype";function k(t,e){for(var n=i.tokenize(t),o=[],s=0;s<n.length;s++){var a=n[s];"nl"===a.t&&e.nl2br?o.push({type:T,tagName:"br",attributes:[],selfClosing:!0}):a.isLink&&e.check(a)?o.push({type:b,rendered:e.render(a)}):o.push({type:D,chars:a.toString()})}return o}function N(t,e,i,n){for(var o=1;i<e.length&&o>0;){var s=e[i];s.type===T&&s.tagName.toUpperCase()===t?o++:s.type===y&&s.tagName.toUpperCase()===t&&o--,n.push(s),i++}return n}function C(t){var e=t.tagName,i=t.attributes,n=t.content;return"<".concat(e," ").concat(function(t){var e=[];for(var i in t){var n=t[i]+"";e.push("".concat(i,'="').concat(I(n),'"'))}return e.join(" ")}(i),">").concat(S(n),"</").concat(e,">")}function S(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function I(t){return t.replace(/"/g,""")}function V(t){for(var e=[],i=0;i<t.length;i++){var n=t[i][0],o=t[i][1]+"";e.push("".concat(n,'="').concat(I(o),'"'))}return e}return function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=m(t),n=[],o=[];e=new g(e,C);for(var s=0;s<i.length;s++){var a=i[s];if(a.type===T){n.push(a);var r=a.tagName.toUpperCase(),h="A"===r||e.ignoreTags.indexOf(r)>=0;if(!h)continue;var u=n.length;N(r,i,++s,n),s+=n.length-u-1}else if(a.type!==D)n.push(a);else{var c=k(a.chars,e);n.push.apply(n,c)}}for(var p=0;p<n.length;p++){var d=n[p];switch(d.type){case b:o.push(d.rendered);break;case T:var f="<"+d.tagName;d.attributes.length>0&&(f+=" "+V(d.attributes).join(" ")),f+=">",o.push(f);break;case y:o.push("</".concat(d.tagName,">"));break;case D:o.push(S(d.chars));break;case v:o.push("\x3c!--".concat(S(d.chars),"--\x3e"));break;case A:var l="<!DOCTYPE ".concat(d.name);d.publicIdentifier&&(l+=' PUBLIC "'.concat(d.publicIdentifier,'"')),d.systemIdentifier&&(l+=' "'.concat(d.systemIdentifier,'"')),l+=">",o.push(l)}}return o.join("")}}(linkify); | ||
var linkifyHtml=function(t){"use strict";function e(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(i){if("default"!==i){var n=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,n.get?n:{enumerable:!0,get:function(){return t[i]}})}})),e.default=t,Object.freeze(e)}var i=e(t),n={amp:"&",gt:">",lt:"<",nbsp:" ",quot:'"'},s=/^#[xX]([A-Fa-f0-9]+)$/,o=/^#([0-9]+)$/,a=/^([A-Za-z0-9]+)$/,r=function(){function t(t){this.named=t}return t.prototype.parse=function(t){if(t){var e=t.match(s);return e?String.fromCharCode(parseInt(e[1],16)):(e=t.match(o))?String.fromCharCode(parseInt(e[1],10)):(e=t.match(a))?this.named[e[1]]||"&"+e[1]+";":void 0}},t}(),h=/[\t\n\f ]/,u=/[A-Za-z]/,p=/\r\n?/g;function c(t){return h.test(t)}function d(t){return u.test(t)}var f=function(){function t(t,e,i){void 0===i&&(i="precompile"),this.delegate=t,this.entityParser=e,this.mode=i,this.state="beforeData",this.line=-1,this.column=-1,this.input="",this.index=-1,this.tagNameBuffer="",this.states={beforeData:function(){var t=this.peek();if("<"!==t||this.isIgnoredEndTag()){if("precompile"===this.mode&&"\n"===t){var e=this.tagNameBuffer.toLowerCase();"pre"!==e&&"textarea"!==e||this.consume()}this.transitionTo("data"),this.delegate.beginData()}else this.transitionTo("tagOpen"),this.markTagStart(),this.consume()},data:function(){var t=this.peek(),e=this.tagNameBuffer;"<"!==t||this.isIgnoredEndTag()?"&"===t&&"script"!==e&&"style"!==e?(this.consume(),this.delegate.appendToData(this.consumeCharRef()||"&")):(this.consume(),this.delegate.appendToData(t)):(this.delegate.finishData(),this.transitionTo("tagOpen"),this.markTagStart(),this.consume())},tagOpen:function(){var t=this.consume();"!"===t?this.transitionTo("markupDeclarationOpen"):"/"===t?this.transitionTo("endTagOpen"):("@"===t||":"===t||d(t))&&(this.transitionTo("tagName"),this.tagNameBuffer="",this.delegate.beginStartTag(),this.appendToTagName(t))},markupDeclarationOpen:function(){var t=this.consume();"-"===t&&"-"===this.peek()?(this.consume(),this.transitionTo("commentStart"),this.delegate.beginComment()):"DOCTYPE"===t.toUpperCase()+this.input.substring(this.index,this.index+6).toUpperCase()&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.transitionTo("doctype"),this.delegate.beginDoctype&&this.delegate.beginDoctype())},doctype:function(){c(this.consume())&&this.transitionTo("beforeDoctypeName")},beforeDoctypeName:function(){var t=this.consume();c(t)||(this.transitionTo("doctypeName"),this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(t.toLowerCase()))},doctypeName:function(){var t=this.consume();c(t)?this.transitionTo("afterDoctypeName"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeName&&this.delegate.appendToDoctypeName(t.toLowerCase())},afterDoctypeName:function(){var t=this.consume();if(!c(t))if(">"===t)this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData");else{var e=t.toUpperCase()+this.input.substring(this.index,this.index+5).toUpperCase(),i="PUBLIC"===e.toUpperCase(),n="SYSTEM"===e.toUpperCase();(i||n)&&(this.consume(),this.consume(),this.consume(),this.consume(),this.consume(),this.consume()),i?this.transitionTo("afterDoctypePublicKeyword"):n&&this.transitionTo("afterDoctypeSystemKeyword")}},afterDoctypePublicKeyword:function(){var t=this.peek();c(t)?(this.transitionTo("beforeDoctypePublicIdentifier"),this.consume()):'"'===t?(this.transitionTo("doctypePublicIdentifierDoubleQuoted"),this.consume()):"'"===t?(this.transitionTo("doctypePublicIdentifierSingleQuoted"),this.consume()):">"===t&&(this.consume(),this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},doctypePublicIdentifierDoubleQuoted:function(){var t=this.consume();'"'===t?this.transitionTo("afterDoctypePublicIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(t)},doctypePublicIdentifierSingleQuoted:function(){var t=this.consume();"'"===t?this.transitionTo("afterDoctypePublicIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypePublicIdentifier&&this.delegate.appendToDoctypePublicIdentifier(t)},afterDoctypePublicIdentifier:function(){var t=this.consume();c(t)?this.transitionTo("betweenDoctypePublicAndSystemIdentifiers"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===t?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===t&&this.transitionTo("doctypeSystemIdentifierSingleQuoted")},betweenDoctypePublicAndSystemIdentifiers:function(){var t=this.consume();c(t)||(">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):'"'===t?this.transitionTo("doctypeSystemIdentifierDoubleQuoted"):"'"===t&&this.transitionTo("doctypeSystemIdentifierSingleQuoted"))},doctypeSystemIdentifierDoubleQuoted:function(){var t=this.consume();'"'===t?this.transitionTo("afterDoctypeSystemIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(t)},doctypeSystemIdentifierSingleQuoted:function(){var t=this.consume();"'"===t?this.transitionTo("afterDoctypeSystemIdentifier"):">"===t?(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData")):this.delegate.appendToDoctypeSystemIdentifier&&this.delegate.appendToDoctypeSystemIdentifier(t)},afterDoctypeSystemIdentifier:function(){var t=this.consume();c(t)||">"===t&&(this.delegate.endDoctype&&this.delegate.endDoctype(),this.transitionTo("beforeData"))},commentStart:function(){var t=this.consume();"-"===t?this.transitionTo("commentStartDash"):">"===t?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData(t),this.transitionTo("comment"))},commentStartDash:function(){var t=this.consume();"-"===t?this.transitionTo("commentEnd"):">"===t?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("-"),this.transitionTo("comment"))},comment:function(){var t=this.consume();"-"===t?this.transitionTo("commentEndDash"):this.delegate.appendToCommentData(t)},commentEndDash:function(){var t=this.consume();"-"===t?this.transitionTo("commentEnd"):(this.delegate.appendToCommentData("-"+t),this.transitionTo("comment"))},commentEnd:function(){var t=this.consume();">"===t?(this.delegate.finishComment(),this.transitionTo("beforeData")):(this.delegate.appendToCommentData("--"+t),this.transitionTo("comment"))},tagName:function(){var t=this.consume();c(t)?this.transitionTo("beforeAttributeName"):"/"===t?this.transitionTo("selfClosingStartTag"):">"===t?(this.delegate.finishTag(),this.transitionTo("beforeData")):this.appendToTagName(t)},endTagName:function(){var t=this.consume();c(t)?(this.transitionTo("beforeAttributeName"),this.tagNameBuffer=""):"/"===t?(this.transitionTo("selfClosingStartTag"),this.tagNameBuffer=""):">"===t?(this.delegate.finishTag(),this.transitionTo("beforeData"),this.tagNameBuffer=""):this.appendToTagName(t)},beforeAttributeName:function(){var t=this.peek();c(t)?this.consume():"/"===t?(this.transitionTo("selfClosingStartTag"),this.consume()):">"===t?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):"="===t?(this.delegate.reportSyntaxError("attribute name cannot start with equals sign"),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(t)):(this.transitionTo("attributeName"),this.delegate.beginAttribute())},attributeName:function(){var t=this.peek();c(t)?(this.transitionTo("afterAttributeName"),this.consume()):"/"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===t?(this.transitionTo("beforeAttributeValue"),this.consume()):">"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):'"'===t||"'"===t||"<"===t?(this.delegate.reportSyntaxError(t+" is not a valid character within attribute names"),this.consume(),this.delegate.appendToAttributeName(t)):(this.consume(),this.delegate.appendToAttributeName(t))},afterAttributeName:function(){var t=this.peek();c(t)?this.consume():"/"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"="===t?(this.consume(),this.transitionTo("beforeAttributeValue")):">"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.transitionTo("attributeName"),this.delegate.beginAttribute(),this.consume(),this.delegate.appendToAttributeName(t))},beforeAttributeValue:function(){var t=this.peek();c(t)?this.consume():'"'===t?(this.transitionTo("attributeValueDoubleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):"'"===t?(this.transitionTo("attributeValueSingleQuoted"),this.delegate.beginAttributeValue(!0),this.consume()):">"===t?(this.delegate.beginAttributeValue(!1),this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.transitionTo("attributeValueUnquoted"),this.delegate.beginAttributeValue(!1),this.consume(),this.delegate.appendToAttributeValue(t))},attributeValueDoubleQuoted:function(){var t=this.consume();'"'===t?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===t?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(t)},attributeValueSingleQuoted:function(){var t=this.consume();"'"===t?(this.delegate.finishAttributeValue(),this.transitionTo("afterAttributeValueQuoted")):"&"===t?this.delegate.appendToAttributeValue(this.consumeCharRef()||"&"):this.delegate.appendToAttributeValue(t)},attributeValueUnquoted:function(){var t=this.peek();c(t)?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("beforeAttributeName")):"/"===t?(this.delegate.finishAttributeValue(),this.consume(),this.transitionTo("selfClosingStartTag")):"&"===t?(this.consume(),this.delegate.appendToAttributeValue(this.consumeCharRef()||"&")):">"===t?(this.delegate.finishAttributeValue(),this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):(this.consume(),this.delegate.appendToAttributeValue(t))},afterAttributeValueQuoted:function(){var t=this.peek();c(t)?(this.consume(),this.transitionTo("beforeAttributeName")):"/"===t?(this.consume(),this.transitionTo("selfClosingStartTag")):">"===t?(this.consume(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},selfClosingStartTag:function(){">"===this.peek()?(this.consume(),this.delegate.markTagAsSelfClosing(),this.delegate.finishTag(),this.transitionTo("beforeData")):this.transitionTo("beforeAttributeName")},endTagOpen:function(){var t=this.consume();("@"===t||":"===t||d(t))&&(this.transitionTo("endTagName"),this.tagNameBuffer="",this.delegate.beginEndTag(),this.appendToTagName(t))}},this.reset()}return t.prototype.reset=function(){this.transitionTo("beforeData"),this.input="",this.tagNameBuffer="",this.index=0,this.line=1,this.column=0,this.delegate.reset()},t.prototype.transitionTo=function(t){this.state=t},t.prototype.tokenize=function(t){this.reset(),this.tokenizePart(t),this.tokenizeEOF()},t.prototype.tokenizePart=function(t){for(this.input+=function(t){return t.replace(p,"\n")}(t);this.index<this.input.length;){var e=this.states[this.state];if(void 0===e)throw new Error("unhandled state "+this.state);e.call(this)}},t.prototype.tokenizeEOF=function(){this.flushData()},t.prototype.flushData=function(){"data"===this.state&&(this.delegate.finishData(),this.transitionTo("beforeData"))},t.prototype.peek=function(){return this.input.charAt(this.index)},t.prototype.consume=function(){var t=this.peek();return this.index++,"\n"===t?(this.line++,this.column=0):this.column++,t},t.prototype.consumeCharRef=function(){var t=this.input.indexOf(";",this.index);if(-1!==t){var e=this.input.slice(this.index,t),i=this.entityParser.parse(e);if(i){for(var n=e.length;n;)this.consume(),n--;return this.consume(),i}}},t.prototype.markTagStart=function(){this.delegate.tagOpen()},t.prototype.appendToTagName=function(t){this.tagNameBuffer+=t,this.delegate.appendToTagName(t)},t.prototype.isIgnoredEndTag=function(){var t=this.tagNameBuffer;return"title"===t&&"</title>"!==this.input.substring(this.index,this.index+8)||"style"===t&&"</style>"!==this.input.substring(this.index,this.index+8)||"script"===t&&"<\/script>"!==this.input.substring(this.index,this.index+9)},t}(),l=function(){function t(t,e){void 0===e&&(e={}),this.options=e,this.token=null,this.startLine=1,this.startColumn=0,this.tokens=[],this.tokenizer=new f(this,t,e.mode),this._currentAttribute=void 0}return t.prototype.tokenize=function(t){return this.tokens=[],this.tokenizer.tokenize(t),this.tokens},t.prototype.tokenizePart=function(t){return this.tokens=[],this.tokenizer.tokenizePart(t),this.tokens},t.prototype.tokenizeEOF=function(){return this.tokens=[],this.tokenizer.tokenizeEOF(),this.tokens[0]},t.prototype.reset=function(){this.token=null,this.startLine=1,this.startColumn=0},t.prototype.current=function(){var t=this.token;if(null===t)throw new Error("token was unexpectedly null");if(0===arguments.length)return t;for(var e=0;e<arguments.length;e++)if(t.type===arguments[e])return t;throw new Error("token type was unexpectedly "+t.type)},t.prototype.push=function(t){this.token=t,this.tokens.push(t)},t.prototype.currentAttribute=function(){return this._currentAttribute},t.prototype.addLocInfo=function(){this.options.loc&&(this.current().loc={start:{line:this.startLine,column:this.startColumn},end:{line:this.tokenizer.line,column:this.tokenizer.column}}),this.startLine=this.tokenizer.line,this.startColumn=this.tokenizer.column},t.prototype.beginDoctype=function(){this.push({type:"Doctype",name:""})},t.prototype.appendToDoctypeName=function(t){this.current("Doctype").name+=t},t.prototype.appendToDoctypePublicIdentifier=function(t){var e=this.current("Doctype");void 0===e.publicIdentifier?e.publicIdentifier=t:e.publicIdentifier+=t},t.prototype.appendToDoctypeSystemIdentifier=function(t){var e=this.current("Doctype");void 0===e.systemIdentifier?e.systemIdentifier=t:e.systemIdentifier+=t},t.prototype.endDoctype=function(){this.addLocInfo()},t.prototype.beginData=function(){this.push({type:"Chars",chars:""})},t.prototype.appendToData=function(t){this.current("Chars").chars+=t},t.prototype.finishData=function(){this.addLocInfo()},t.prototype.beginComment=function(){this.push({type:"Comment",chars:""})},t.prototype.appendToCommentData=function(t){this.current("Comment").chars+=t},t.prototype.finishComment=function(){this.addLocInfo()},t.prototype.tagOpen=function(){},t.prototype.beginStartTag=function(){this.push({type:"StartTag",tagName:"",attributes:[],selfClosing:!1})},t.prototype.beginEndTag=function(){this.push({type:"EndTag",tagName:""})},t.prototype.finishTag=function(){this.addLocInfo()},t.prototype.markTagAsSelfClosing=function(){this.current("StartTag").selfClosing=!0},t.prototype.appendToTagName=function(t){this.current("StartTag","EndTag").tagName+=t},t.prototype.beginAttribute=function(){this._currentAttribute=["","",!1]},t.prototype.appendToAttributeName=function(t){this.currentAttribute()[0]+=t},t.prototype.beginAttributeValue=function(t){this.currentAttribute()[2]=t},t.prototype.appendToAttributeValue=function(t){this.currentAttribute()[1]+=t},t.prototype.finishAttributeValue=function(){this.current("StartTag").attributes.push(this._currentAttribute)},t.prototype.reportSyntaxError=function(t){this.current().syntaxError=t},t}();var m=i.Options,g="LinkifyResult",b="StartTag",T="EndTag",y="Chars";function D(t,e){for(var n=i.tokenize(t),s=[],o=0;o<n.length;o++){var a=n[o];"nl"===a.t&&e.nl2br?s.push({type:b,tagName:"br",attributes:[],selfClosing:!0}):a.isLink&&e.check(a)?s.push({type:g,rendered:e.render(a)}):s.push({type:y,chars:a.toString()})}return s}function v(t,e,i,n){for(var s=1;i<e.length&&s>0;){var o=e[i];o.type===b&&o.tagName.toUpperCase()===t?s++:o.type===T&&o.tagName.toUpperCase()===t&&s--,n.push(o),i++}return n}function A(t){var e=t.tagName,i=t.attributes,n=t.content;return"<"+e+" "+function(t){var e=[];for(var i in t){var n=t[i]+"";e.push(i+'="'+C(n)+'"')}return e.join(" ")}(i)+">"+k(n)+"</"+e+">"}function k(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function C(t){return t.replace(/"/g,""")}function N(t){for(var e=[],i=0;i<t.length;i++){var n=t[i][0],s=t[i][1]+"";e.push(n+'="'+C(s)+'"')}return e}return function(t,e){void 0===e&&(e={});var i,s,o=(i=t,new l(new r(n),s).tokenize(i)),a=[],h=[];e=new m(e,A);for(var u=0;u<o.length;u++){var p=o[u];if(p.type===b){a.push(p);var c=p.tagName.toUpperCase();if(!("A"===c||e.ignoreTags.indexOf(c)>=0))continue;var d=a.length;v(c,o,++u,a),u+=a.length-d-1}else if(p.type!==y)a.push(p);else{var f=D(p.chars,e);a.push.apply(a,f)}}for(var C=0;C<a.length;C++){var S=a[C];switch(S.type){case g:h.push(S.rendered);break;case b:var I="<"+S.tagName;S.attributes.length>0&&(I+=" "+N(S.attributes).join(" ")),S.selfClosing&&(I+=" /"),I+=">",h.push(I);break;case T:h.push("</"+S.tagName+">");break;case y:h.push(k(S.chars));break;case"Comment":h.push("\x3c!--"+k(S.chars)+"--\x3e");break;case"Doctype":var V="<!DOCTYPE "+S.name;S.publicIdentifier&&(V+=' PUBLIC "'+S.publicIdentifier+'"'),S.systemIdentifier&&(V+=' "'+S.systemIdentifier+'"'),V+=">",h.push(V)}}return h.join("")}}(linkify); |
@@ -7,2 +7,2 @@ export { linkifyHtml as default }; | ||
*/ | ||
declare function linkifyHtml(str: string, ...args: any[]): string; | ||
declare function linkifyHtml(str: string, opts?: object): string; |
@@ -1142,4 +1142,7 @@ import * as linkify from 'linkifyjs'; | ||
function linkifyHtml(str) { | ||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
function linkifyHtml(str, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
// `tokens` and `token` in this section refer to tokens generated by the | ||
@@ -1195,2 +1198,6 @@ // HTML parser, not linkify's parser | ||
if (_token.selfClosing) { | ||
link += ' /'; | ||
} | ||
link += '>'; | ||
@@ -1202,3 +1209,3 @@ linkified.push(link); | ||
case EndTag: | ||
linkified.push("</".concat(_token.tagName, ">")); | ||
linkified.push("</" + _token.tagName + ">"); | ||
break; | ||
@@ -1211,3 +1218,3 @@ | ||
case Comment: | ||
linkified.push("<!--".concat(escapeText(_token.chars), "-->")); | ||
linkified.push("<!--" + escapeText(_token.chars) + "-->"); | ||
break; | ||
@@ -1217,10 +1224,10 @@ | ||
{ | ||
var doctype = "<!DOCTYPE ".concat(_token.name); | ||
var doctype = "<!DOCTYPE " + _token.name; | ||
if (_token.publicIdentifier) { | ||
doctype += " PUBLIC \"".concat(_token.publicIdentifier, "\""); | ||
doctype += " PUBLIC \"" + _token.publicIdentifier + "\""; | ||
} | ||
if (_token.systemIdentifier) { | ||
doctype += " \"".concat(_token.systemIdentifier, "\""); | ||
doctype += " \"" + _token.systemIdentifier + "\""; | ||
} | ||
@@ -1314,3 +1321,3 @@ | ||
content = _ref.content; | ||
return "<".concat(tagName, " ").concat(attributesToString(attributes), ">").concat(escapeText(content), "</").concat(tagName, ">"); | ||
return "<" + tagName + " " + attributesToString(attributes) + ">" + escapeText(content) + "</" + tagName + ">"; | ||
} | ||
@@ -1331,3 +1338,3 @@ | ||
var val = attributes[attr] + ''; | ||
result.push("".concat(attr, "=\"").concat(escapeAttr(val), "\"")); | ||
result.push(attr + "=\"" + escapeAttr(val) + "\""); | ||
} | ||
@@ -1344,3 +1351,3 @@ | ||
var value = attrs[i][1] + ''; | ||
attrStrs.push("".concat(name, "=\"").concat(escapeAttr(value), "\"")); | ||
attrStrs.push(name + "=\"" + escapeAttr(value) + "\""); | ||
} | ||
@@ -1347,0 +1354,0 @@ |
@@ -7,2 +7,2 @@ export = linkifyHtml; | ||
*/ | ||
declare function linkifyHtml(str: string, ...args: any[]): string; | ||
declare function linkifyHtml(str: string, opts?: object): string; |
27
index.js
@@ -1164,4 +1164,7 @@ 'use strict'; | ||
function linkifyHtml(str) { | ||
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; | ||
function linkifyHtml(str, opts) { | ||
if (opts === void 0) { | ||
opts = {}; | ||
} | ||
// `tokens` and `token` in this section refer to tokens generated by the | ||
@@ -1217,2 +1220,6 @@ // HTML parser, not linkify's parser | ||
if (_token.selfClosing) { | ||
link += ' /'; | ||
} | ||
link += '>'; | ||
@@ -1224,3 +1231,3 @@ linkified.push(link); | ||
case EndTag: | ||
linkified.push("</".concat(_token.tagName, ">")); | ||
linkified.push("</" + _token.tagName + ">"); | ||
break; | ||
@@ -1233,3 +1240,3 @@ | ||
case Comment: | ||
linkified.push("<!--".concat(escapeText(_token.chars), "-->")); | ||
linkified.push("<!--" + escapeText(_token.chars) + "-->"); | ||
break; | ||
@@ -1239,10 +1246,10 @@ | ||
{ | ||
var doctype = "<!DOCTYPE ".concat(_token.name); | ||
var doctype = "<!DOCTYPE " + _token.name; | ||
if (_token.publicIdentifier) { | ||
doctype += " PUBLIC \"".concat(_token.publicIdentifier, "\""); | ||
doctype += " PUBLIC \"" + _token.publicIdentifier + "\""; | ||
} | ||
if (_token.systemIdentifier) { | ||
doctype += " \"".concat(_token.systemIdentifier, "\""); | ||
doctype += " \"" + _token.systemIdentifier + "\""; | ||
} | ||
@@ -1336,3 +1343,3 @@ | ||
content = _ref.content; | ||
return "<".concat(tagName, " ").concat(attributesToString(attributes), ">").concat(escapeText(content), "</").concat(tagName, ">"); | ||
return "<" + tagName + " " + attributesToString(attributes) + ">" + escapeText(content) + "</" + tagName + ">"; | ||
} | ||
@@ -1353,3 +1360,3 @@ | ||
var val = attributes[attr] + ''; | ||
result.push("".concat(attr, "=\"").concat(escapeAttr(val), "\"")); | ||
result.push(attr + "=\"" + escapeAttr(val) + "\""); | ||
} | ||
@@ -1366,3 +1373,3 @@ | ||
var value = attrs[i][1] + ''; | ||
attrStrs.push("".concat(name, "=\"").concat(escapeAttr(value), "\"")); | ||
attrStrs.push(name + "=\"" + escapeAttr(value) + "\""); | ||
} | ||
@@ -1369,0 +1376,0 @@ |
{ | ||
"name": "linkify-html", | ||
"version": "4.0.0-beta.1", | ||
"version": "4.0.0-beta.2", | ||
"description": "HTML String interface for linkifyjs", | ||
@@ -36,4 +36,4 @@ "main": "index.js", | ||
"peerDependencies": { | ||
"linkifyjs": "*" | ||
"linkifyjs": "^4.0.0-beta.1" | ||
} | ||
} |
3660
140341