fix handling of empty hrefs during export (#602)

This commit is contained in:
Conduitry
2019-03-11 10:39:35 -04:00
parent 7be7e1eb9f
commit 6d5aa9a35d
2 changed files with 8 additions and 3 deletions

View File

@@ -212,6 +212,6 @@ async function _export({
}
function get_href(attrs: string) {
const match = /href\s*=\s*(?:"(.*?)"|'(.+?)'|([^\s>]+))/.exec(attrs);
return match[1] || match[2] || match[3];
const match = /href\s*=\s*(?:"(.*?)"|'(.*?)'|([^\s>]*))/.exec(attrs);
return match && (match[1] || match[2] || match[3]);
}

View File

@@ -1,4 +1,9 @@
<h1>Great success!</h1>
<a href="blog">blog</a>
<a href="">empty anchor</a>
<a href="">empty anchor</a>
<a href=''>empty anchor #2</a>
<a href=>empty anchor #3</a>
<a href= >empty anchor #4</a>
<a href>empty anchor #5</a>
<a>empty anchor #6</a>