From 1d790b8c78a2925a788e7167ed8d9d52d8e23906 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Wed, 15 Feb 2017 23:27:00 +0100 Subject: content-parser: source-parser: rename TITLE to FIRST_HEADER --- src/blogc/content-parser.c | 6 +++--- src/blogc/content-parser.h | 4 ++-- src/blogc/source-parser.c | 16 ++++++++-------- 3 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/blogc/content-parser.c b/src/blogc/content-parser.c index 86aa74b..8e26943 100644 --- a/src/blogc/content-parser.c +++ b/src/blogc/content-parser.c @@ -674,7 +674,7 @@ blogc_is_ordered_list_item(const char *str, size_t prefix_len) char* -blogc_content_parse(const char *src, size_t *end_excerpt, char **title, +blogc_content_parse(const char *src, size_t *end_excerpt, char **first_header, char **description) { // src is always nul-terminated. @@ -835,8 +835,8 @@ blogc_content_parse(const char *src, size_t *end_excerpt, char **title, end = is_last && c != '\n' && c != '\r' ? src_len : (real_end != 0 ? real_end : current); tmp = bc_strndup(src + start, end - start); - if (title != NULL && *title == NULL) - *title = blogc_htmlentities(tmp); + if (first_header != NULL && *first_header == NULL) + *first_header = blogc_htmlentities(tmp); parsed = blogc_content_parse_inline(tmp); slug = blogc_slugify(tmp); if (slug == NULL) diff --git a/src/blogc/content-parser.h b/src/blogc/content-parser.h index 39230c6..3b5b85c 100644 --- a/src/blogc/content-parser.h +++ b/src/blogc/content-parser.h @@ -17,7 +17,7 @@ char* blogc_htmlentities(const char *str); char* blogc_fix_description(const char *paragraph); char* blogc_content_parse_inline(const char *src); bool blogc_is_ordered_list_item(const char *str, size_t prefix_len); -char* blogc_content_parse(const char *src, size_t *end_excerpt, char **title, - char **description); +char* blogc_content_parse(const char *src, size_t *end_excerpt, + char **first_header, char **description); #endif /* _CONTENT_PARSER_H */ diff --git a/src/blogc/source-parser.c b/src/blogc/source-parser.c index f6f3471..eb0a975 100644 --- a/src/blogc/source-parser.c +++ b/src/blogc/source-parser.c @@ -150,19 +150,19 @@ 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 *first_header = NULL; char *description = NULL; - 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")) { + content = blogc_content_parse(tmp, &end_excerpt, + &first_header, &description); + if (first_header != NULL) { + // do not override source-provided first_header. + if (NULL == bc_trie_lookup(rv, "FIRST_HEADER")) { // no need to free, because we are transfering memory // ownership to the trie. - bc_trie_insert(rv, "TITLE", title); + bc_trie_insert(rv, "FIRST_HEADER", first_header); } else { - free(title); + free(first_header); } } if (description != NULL) { -- cgit v1.2.3-18-g5258