diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-02-15 18:26:35 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-02-15 18:26:35 -0800 |
commit | 376f81ab8aa017ab01040e10d393d7682674562d (patch) | |
tree | c6a9c8982f76df9afcc42f3822e339701a08f3c6 /src/blocks.c | |
parent | 982ba5a528111dbf647e90f412498e315fcf432c (diff) |
Added options parameter to cmark_parse_document, cmark_parse_file.
Also to some non-exported functions in blocks and inlines.
Diffstat (limited to 'src/blocks.c')
-rw-r--r-- | src/blocks.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/blocks.c b/src/blocks.c index 1007415..f2e4e8e 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -50,7 +50,7 @@ static cmark_node* make_document() return e; } -cmark_parser *cmark_parser_new() +cmark_parser *cmark_parser_new(long options) { cmark_parser *parser = (cmark_parser*)malloc(sizeof(cmark_parser)); cmark_node *document = make_document(); @@ -66,6 +66,7 @@ cmark_parser *cmark_parser_new() parser->curline = line; parser->last_line_length = 0; parser->linebuf = buf; + parser->options = options; return parser; } @@ -316,7 +317,7 @@ static cmark_node* add_child(cmark_parser *parser, cmark_node* parent, // Walk through cmark_node and all children, recursively, parsing // string content into inline content where appropriate. -static void process_inlines(cmark_node* root, cmark_reference_map *refmap) +static void process_inlines(cmark_node* root, cmark_reference_map *refmap, long options) { cmark_iter *iter = cmark_iter_new(root); cmark_node *cur; @@ -327,7 +328,7 @@ static void process_inlines(cmark_node* root, cmark_reference_map *refmap) if (ev_type == CMARK_EVENT_ENTER) { if (cur->type == NODE_PARAGRAPH || cur->type == NODE_HEADER) { - cmark_parse_inlines(cur, refmap); + cmark_parse_inlines(cur, refmap, options); } } } @@ -416,15 +417,15 @@ static cmark_node *finalize_document(cmark_parser *parser) } finalize(parser, parser->root); - process_inlines(parser->root, parser->refmap); + process_inlines(parser->root, parser->refmap, parser->options); return parser->root; } -cmark_node *cmark_parse_file(FILE *f) +cmark_node *cmark_parse_file(FILE *f, long options) { unsigned char buffer[4096]; - cmark_parser *parser = cmark_parser_new(); + cmark_parser *parser = cmark_parser_new(options); size_t bytes; cmark_node *document; @@ -441,9 +442,9 @@ cmark_node *cmark_parse_file(FILE *f) return document; } -cmark_node *cmark_parse_document(const char *buffer, size_t len) +cmark_node *cmark_parse_document(const char *buffer, size_t len, long options) { - cmark_parser *parser = cmark_parser_new(); + cmark_parser *parser = cmark_parser_new(options); cmark_node *document; S_parser_feed(parser, (const unsigned char *)buffer, len, true); |