aboutsummaryrefslogtreecommitdiffstats
path: root/src/source-parser.c
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2015-06-13 03:32:21 -0300
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2015-06-13 03:32:21 -0300
commit3aeccf252c8c266b51c1a2cc1dc9e9e3d5bf2f90 (patch)
treebc7a75a51d2fbf180c9d63ee1164b93ca21b9b6f /src/source-parser.c
parent168de93a068e489eb96c541172de5e43e13a5873 (diff)
downloadblogc-3aeccf252c8c266b51c1a2cc1dc9e9e3d5bf2f90.tar.gz
blogc-3aeccf252c8c266b51c1a2cc1dc9e9e3d5bf2f90.tar.bz2
blogc-3aeccf252c8c266b51c1a2cc1dc9e9e3d5bf2f90.zip
content-parser: implemented excerpt, and now for good!
Diffstat (limited to 'src/source-parser.c')
-rw-r--r--src/source-parser.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/source-parser.c b/src/source-parser.c
index f0fca29..050082f 100644
--- a/src/source-parser.c
+++ b/src/source-parser.c
@@ -38,6 +38,7 @@ 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;
@@ -148,7 +149,13 @@ blogc_source_parse(const char *src, size_t src_len, blogc_error_t **err)
if (current == (src_len - 1)) {
tmp = b_strndup(src + start, src_len - start);
b_trie_insert(rv, "RAW_CONTENT", tmp);
- b_trie_insert(rv, "CONTENT", blogc_content_parse(tmp));
+ b_trie_insert(rv, "CONTENT", blogc_content_parse(tmp, &end_excerpt));
+ if (end_excerpt != 0)
+ b_trie_insert(rv, "EXCERPT",
+ b_strndup(b_trie_lookup(rv, "CONTENT"), end_excerpt));
+ else
+ b_trie_insert(rv, "EXCERPT",
+ b_strdup(b_trie_lookup(rv, "CONTENT")));
}
break;
}