From 6d5aa9a35dd92d2853141ccc329d9a4db6bca620 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Mon, 11 Mar 2019 10:39:35 -0400 Subject: [PATCH] fix handling of empty hrefs during export (#602) --- src/api/export.ts | 4 ++-- test/apps/export/src/routes/index.svelte | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/api/export.ts b/src/api/export.ts index ba6a9db..1d1be4c 100644 --- a/src/api/export.ts +++ b/src/api/export.ts @@ -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]); } diff --git a/test/apps/export/src/routes/index.svelte b/test/apps/export/src/routes/index.svelte index cdeb5a8..1928902 100644 --- a/test/apps/export/src/routes/index.svelte +++ b/test/apps/export/src/routes/index.svelte @@ -1,4 +1,9 @@

Great success!

blog -empty anchor \ No newline at end of file +empty anchor +empty anchor #2 +empty anchor #3 +empty anchor #4 +empty anchor #5 +empty anchor #6