refine markdown objects + added functions to header
authorMichael Göhler <somebody.here@gmx.de>
Sat, 16 Aug 2014 15:34:38 +0000 (17:34 +0200)
committerMichael Göhler <somebody.here@gmx.de>
Sat, 16 Aug 2014 15:34:38 +0000 (17:34 +0200)
include/markdown.h

index 357de78..b4812f5 100644 (file)
@@ -19,18 +19,21 @@ enum line_bitmask {
     IS_QUOTE,
     IS_CODE,
     IS_LIST,
-    IS_NUMLIST
+    IS_NUMLIST,
+    IS_HR
 };
 
 typedef struct _line_t {
     cstring_t *text;
+    struct _line_t *prev;
     struct _line_t *next;
     int bits;
-    int left_white_space;
+    int offset;
 } line_t;
 
 typedef struct _page_t {
-    line_t *lines;
+    line_t *line;
+    struct _page_t *prev;
     struct _page_t *next;
 } page_t;
 
@@ -38,7 +41,36 @@ typedef struct _document_t {
     line_t *title;
     line_t *author;
     line_t *date;
-    page_t *pages;
+    page_t *page;
 } document_t;
 
+line_t *new_line() {
+    line_t *x = malloc(sizeof(line_t));
+    return x;
+}
+
+line_t *next_line(line_t *prev) {
+    line_t *x = new_line();
+    x->prev = prev;
+    prev->next = x;
+    return x;
+}
+
+page_t *new_page() {
+    page_t *x = malloc(sizeof(page_t));
+    return x;
+}
+
+page_t *next_page(page_t *prev) {
+    page_t *x = new_page();
+    x->prev = prev;
+    prev->next = x;
+    return x;
+}
+
+document_t *new_document() {
+    document_t *x = malloc(sizeof(document_t));
+    return x;
+}
+
 #endif // !defined( MARKDOWN_H )