diff options
-rw-r--r-- | man/blogc-source.7.ronn | 3 | ||||
-rw-r--r-- | src/blogc/content-parser.c | 4 | ||||
-rw-r--r-- | tests/blogc/check_content_parser.c | 14 |
3 files changed, 16 insertions, 5 deletions
diff --git a/man/blogc-source.7.ronn b/man/blogc-source.7.ronn index 06f2f20..56fa552 100644 --- a/man/blogc-source.7.ronn +++ b/man/blogc-source.7.ronn @@ -219,6 +219,9 @@ Code is defined with 1 or 2 '`' before and after the text. This is inline code: `code` This is inline code: ``code`` +The later form is particularly useful when a '`' is part of the code, because +escaping delimiters with '\' is not possible. + ### Images Images are defined using the following syntax: diff --git a/src/blogc/content-parser.c b/src/blogc/content-parser.c index d295a2c..047af4b 100644 --- a/src/blogc/content-parser.c +++ b/src/blogc/content-parser.c @@ -347,7 +347,7 @@ blogc_content_parse_inline_internal(const char *src, size_t src_len) free(tmp3); tmp3 = NULL; bc_string_append(rv, "<code>"); - bc_string_append_escaped(rv, tmp2); + bc_string_append(rv, tmp2); bc_string_append(rv, "</code>"); current = tmp - src; tmp = NULL; @@ -376,7 +376,7 @@ blogc_content_parse_inline_internal(const char *src, size_t src_len) free(tmp3); tmp3 = NULL; bc_string_append(rv, "<code>"); - bc_string_append_escaped(rv, tmp2); + bc_string_append(rv, tmp2); bc_string_append(rv, "</code>"); current = tmp - src + 1; tmp = NULL; diff --git a/tests/blogc/check_content_parser.c b/tests/blogc/check_content_parser.c index cd8ba57..de15bac 100644 --- a/tests/blogc/check_content_parser.c +++ b/tests/blogc/check_content_parser.c @@ -1951,11 +1951,15 @@ test_content_parse_inline_code(void **state) free(html); html = blogc_content_parse_inline("`bo\\`\\`la`\n"); assert_non_null(html); - assert_string_equal(html, "<code>bo``la</code>\n"); + assert_string_equal(html, "<code>bo\\`\\`la</code>\n"); free(html); html = blogc_content_parse_inline("``bo\\`\\`la``\n"); assert_non_null(html); - assert_string_equal(html, "<code>bo``la</code>\n"); + assert_string_equal(html, "<code>bo\\`\\`la</code>\n"); + free(html); + html = blogc_content_parse_inline("``bo`la``\n"); + assert_non_null(html); + assert_string_equal(html, "<code>bo`la</code>\n"); free(html); html = blogc_content_parse_inline("``bola\n"); assert_non_null(html); @@ -2009,7 +2013,11 @@ test_content_parse_inline_link(void **state) free(html); html = blogc_content_parse_inline("[``bola(2)[3]**!\\```](http://example.org/)\n"); assert_non_null(html); - assert_string_equal(html, "<a href=\"http://example.org/\"><code>bola(2)[3]**!`</code></a>\n"); + assert_string_equal(html, "<a href=\"http://example.org/\"><code>bola(2)[3]**!\\`</code></a>\n"); + free(html); + html = blogc_content_parse_inline("[``bola(2)[3]**!```](http://example.org/)\n"); + assert_non_null(html); + assert_string_equal(html, "<a href=\"http://example.org/\"><code>bola(2)[3]**!</code>`</a>\n"); free(html); html = blogc_content_parse_inline("test suite!)\n" "depends on [cmocka](http://cmocka.org/), though.\n"); |