diff options
-rw-r--r-- | spec.txt | 2 | ||||
-rw-r--r-- | src/html/html.c | 6 | ||||
-rw-r--r-- | src/inlines.c | 3 | ||||
-rw-r--r-- | src/print.c | 5 |
4 files changed, 12 insertions, 4 deletions
@@ -3946,7 +3946,7 @@ But this is a link: . <http://foo.bar.`baz>` . -<p><a href="http://foo.bar.`baz">http://foo.bar.`baz</a>`</p> +<p><a href="http://foo.bar.%60baz">http://foo.bar.`baz</a>`</p> . And this is an HTML tag: diff --git a/src/html/html.c b/src/html/html.c index 913a602..41b8fda 100644 --- a/src/html/html.c +++ b/src/html/html.c @@ -174,7 +174,8 @@ void inlines_to_html(gh_buf *html, inl* ils) case INL_LINK: gh_buf_puts(html, "<a href=\""); - escape_href(html, ils->content.linkable.url, -1); + if (ils->content.linkable.url) + escape_href(html, ils->content.linkable.url, -1); if (ils->content.linkable.title) { gh_buf_puts(html, "\" title=\""); @@ -188,7 +189,8 @@ void inlines_to_html(gh_buf *html, inl* ils) case INL_IMAGE: gh_buf_puts(html, "<img src=\""); - escape_href(html, ils->content.linkable.url, -1); + if (ils->content.linkable.url) + escape_href(html, ils->content.linkable.url, -1); inlines_to_html(&scrap, ils->content.inlines); gh_buf_puts(html, "\" alt=\""); diff --git a/src/inlines.c b/src/inlines.c index 599be84..8e2e683 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -591,6 +591,9 @@ static unsigned char *clean_url(chunk *url, int is_email) chunk_trim(url); + if (url->len == 0) + return NULL; + if (is_email) gh_buf_puts(&buf, "mailto:"); diff --git a/src/print.c b/src/print.c index c262995..832ad4f 100644 --- a/src/print.c +++ b/src/print.c @@ -153,7 +153,10 @@ extern void print_inlines(inl* ils, int indent) case INL_LINK: case INL_IMAGE: printf("%s url=", ils->tag == INL_LINK ? "link" : "image"); - print_str(ils->content.linkable.url, -1); + + if (ils->content.linkable.url) + print_str(ils->content.linkable.url, -1); + if (ils->content.linkable.title) { printf(" title="); print_str(ils->content.linkable.title, -1); |