diff options
Diffstat (limited to 'src/blogc/source-parser.c')
-rw-r--r-- | src/blogc/source-parser.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/blogc/source-parser.c b/src/blogc/source-parser.c index a3d1e09..f6f3471 100644 --- a/src/blogc/source-parser.c +++ b/src/blogc/source-parser.c @@ -150,8 +150,21 @@ blogc_source_parse(const char *src, size_t src_len, bc_error_t **err) if (current == (src_len - 1)) { tmp = bc_strndup(src + start, src_len - start); bc_trie_insert(rv, "RAW_CONTENT", tmp); + char *title = NULL; char *description = NULL; - content = blogc_content_parse(tmp, &end_excerpt, &description); + content = blogc_content_parse(tmp, &end_excerpt, &title, + &description); + if (title != NULL) { + // do not override source-provided title. + if (NULL == bc_trie_lookup(rv, "TITLE")) { + // no need to free, because we are transfering memory + // ownership to the trie. + bc_trie_insert(rv, "TITLE", title); + } + else { + free(title); + } + } if (description != NULL) { // do not override source-provided description. if (NULL == bc_trie_lookup(rv, "DESCRIPTION")) { |