diff options
-rw-r--r-- | src/content-parser.c | 22 | ||||
-rw-r--r-- | tests/check_content_parser.c | 2 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/content-parser.c b/src/content-parser.c index 29a20bb..676da8b 100644 --- a/src/content-parser.c +++ b/src/content-parser.c @@ -280,6 +280,7 @@ blogc_content_parse(const char *src, size_t src_len, blogc_error_t **err) size_t prefix_len = 0; char *tmp = NULL; char *tmp2 = NULL; + char *tmp3 = NULL; char *parsed = NULL; char **tmpv = NULL; @@ -539,7 +540,13 @@ blogc_content_parse(const char *src, size_t src_len, blogc_error_t **err) end = is_last && c != '\n' && c != '\r' ? src_len : current; tmp = b_strndup(src + start, end - start); if (b_str_starts_with(tmp, prefix)) { - lines = b_slist_append(lines, b_strdup(tmp + strlen(prefix))); + tmp3 = b_strdup(tmp + strlen(prefix)); + parsed = blogc_content_parse_inline(tmp3); + free(tmp3); + tmp3 = NULL; + lines = b_slist_append(lines, b_strdup(parsed)); + free(parsed); + parsed = NULL; } else { *err = blogc_error_parser(BLOGC_ERROR_CONTENT_PARSER, src, src_len, @@ -623,8 +630,14 @@ blogc_content_parse(const char *src, size_t src_len, blogc_error_t **err) goto err_li; } } - lines = b_slist_append(lines, b_strdup(tmp + prefix_len)); + tmp3 = b_strdup(tmp + prefix_len); + parsed = blogc_content_parse_inline(tmp3); + free(tmp3); + tmp3 = NULL; + lines = b_slist_append(lines, b_strdup(parsed)); state = CONTENT_ORDERED_LIST_END; + free(parsed); + parsed = NULL; err_li: b_strv_free(tmpv); tmpv = NULL; @@ -665,7 +678,10 @@ err_li: case CONTENT_PARAGRAPH_END: if (c == '\n' || c == '\r' || is_last) { tmp = b_strndup(src + start, end - start); - b_string_append_printf(rv, "<p>%s</p>\n", tmp); + parsed = blogc_content_parse_inline(tmp); + b_string_append_printf(rv, "<p>%s</p>\n", parsed); + free(parsed); + parsed = NULL; free(tmp); tmp = NULL; state = CONTENT_START_LINE; diff --git a/tests/check_content_parser.c b/tests/check_content_parser.c index a613052..ab1bf49 100644 --- a/tests/check_content_parser.c +++ b/tests/check_content_parser.c @@ -94,7 +94,7 @@ test_content_parse(void **state) "</style>\n" "<p>guda\n" "yay</p>\n" - "<p>**bola**</p>\n"); + "<p><strong>bola</strong></p>\n"); free(html); } |