aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2016-06-23 00:46:06 +0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2016-07-16 01:58:49 +0200
commit5ce910e4883f44be79055d0bf71f7703097f4026 (patch)
treef948052f0b25bad8b0248dbb279fc837a4445a3d /src
parentf40bc3931a7194f7361f9cbe35d0f42a1ce444be (diff)
downloadblogc-5ce910e4883f44be79055d0bf71f7703097f4026.tar.gz
blogc-5ce910e4883f44be79055d0bf71f7703097f4026.tar.bz2
blogc-5ce910e4883f44be79055d0bf71f7703097f4026.zip
content-parser: added basic data structures for ast
Diffstat (limited to 'src')
-rw-r--r--src/content-parser.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/content-parser.h b/src/content-parser.h
index 37e38d7..a0e403c 100644
--- a/src/content-parser.h
+++ b/src/content-parser.h
@@ -12,6 +12,47 @@
#include <stddef.h>
#include <stdbool.h>
+#include "utils.h"
+
+typedef enum {
+ BLOGC_CONTENT_BLOCK = 1,
+ BLOGC_CONTENT_INLINE,
+} blogc_content_node_type_t;
+
+typedef enum {
+ BLOGC_CONTENT_BLOCK_HEADER = 1,
+ BLOGC_CONTENT_BLOCK_RAW,
+ BLOGC_CONTENT_BLOCK_BLOCKQUOTE,
+ BLOGC_CONTENT_BLOCK_CODE,
+ BLOGC_CONTENT_BLOCK_HORIZONTAL_RULE,
+ BLOGC_CONTENT_BLOCK_UNORDERED_LIST,
+ BLOGC_CONTENT_BLOCK_ORDERED_LIST,
+ BLOGC_CONTENT_BLOCK_LIST_ITEM,
+ BLOGC_CONTENT_BLOCK_PARAGRAPH,
+} blogc_content_block_type_t;
+
+typedef enum {
+ BLOGC_CONTENT_INLINE_LINK = 1,
+ BLOGC_CONTENT_INLINE_IMAGE,
+ BLOGC_CONTENT_INLINE_BOLD,
+ BLOGC_CONTENT_INLINE_ITALIC,
+ BLOGC_CONTENT_INLINE_CODE,
+ BLOGC_CONTENT_INLINE_BREAK_LINE,
+} blogc_content_inline_type_t;
+
+typedef struct _blogc_content_node_t {
+ blogc_content_node_type_t node_type;
+ union {
+ blogc_content_block_type_t block_type;
+ blogc_content_inline_type_t inline_type;
+ } type;
+ union {
+ struct _blogc_content_node_t *block;
+ char *content;
+ } child;
+ sb_trie_t *parameters;
+} blogc_content_node_t;
+
char* blogc_slugify(const char *str);
char* blogc_htmlentities(const char *str);
char* blogc_fix_description(const char *paragraph);