diff options
author | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-06-25 01:09:23 +0200 |
---|---|---|
committer | Rafael G. Martins <rafael@rafaelmartins.eng.br> | 2016-07-16 02:02:14 +0200 |
commit | feb3ed33717d04973a052ebca8c6872c517a2acf (patch) | |
tree | fc9dcb1c60449f3181aebb889a3dafb11226d92b /src/source-parser.c | |
parent | b88cdf4fd29bb74022ccf752ace910244767f977 (diff) | |
download | blogc-feb3ed33717d04973a052ebca8c6872c517a2acf.tar.gz blogc-feb3ed33717d04973a052ebca8c6872c517a2acf.tar.bz2 blogc-feb3ed33717d04973a052ebca8c6872c517a2acf.zip |
content-parser: added ast for content blocks. pending inline and testsfeature/content-parser-ast
Diffstat (limited to 'src/source-parser.c')
-rw-r--r-- | src/source-parser.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/source-parser.c b/src/source-parser.c index 5d29213..349d3f7 100644 --- a/src/source-parser.c +++ b/src/source-parser.c @@ -34,7 +34,6 @@ blogc_source_parse(const char *src, size_t src_len, blogc_error_t **err) size_t current = 0; size_t start = 0; - size_t end_excerpt = 0; char *key = NULL; char *tmp = NULL; @@ -150,8 +149,9 @@ blogc_source_parse(const char *src, size_t src_len, blogc_error_t **err) if (current == (src_len - 1)) { tmp = sb_strndup(src + start, src_len - start); sb_trie_insert(rv, "RAW_CONTENT", tmp); + char *excerpt = NULL; char *description = NULL; - content = blogc_content_parse(tmp, &end_excerpt, &description); + content = blogc_content_parse(tmp, &excerpt, &description); if (description != NULL) { // do not override source-provided description. if (NULL == sb_trie_lookup(rv, "DESCRIPTION")) { @@ -163,9 +163,9 @@ blogc_source_parse(const char *src, size_t src_len, blogc_error_t **err) free(description); } } + sb_trie_insert(rv, "EXCERPT", excerpt == NULL ? + sb_strdup(content) : excerpt); sb_trie_insert(rv, "CONTENT", content); - sb_trie_insert(rv, "EXCERPT", end_excerpt == 0 ? - sb_strdup(content) : sb_strndup(content, end_excerpt)); } break; } |