diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 09:26:35 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-01-09 09:32:59 -0800 |
commit | 996a96c1972697e320a958c0d6bf43e677398f01 (patch) | |
tree | cb113ebae24c07e08cab22d9a7a0845d960ba831 | |
parent | 363c25c0a5584c0f936aaa9481b2130e29afa291 (diff) |
xml writer: add list attributes.
-rw-r--r-- | src/xml.c | 27 |
1 files changed, 26 insertions, 1 deletions
@@ -40,7 +40,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, { cmark_strbuf *xml = state->xml; bool literal = false; - + cmark_delim_type delim; bool entering = (ev_type == CMARK_EVENT_ENTER); if (entering) { @@ -71,6 +71,31 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, cmark_node_get_type_string(node)); literal = true; break; + case CMARK_NODE_LIST: + switch (cmark_node_get_list_type(node)) { + case CMARK_ORDERED_LIST: + cmark_strbuf_puts(xml, " type=\"ordered\""); + cmark_strbuf_printf(xml, " start=\"%d\"", + cmark_node_get_list_start(node)); + delim = cmark_node_get_list_delim(node); + if (delim == CMARK_PAREN_DELIM) { + cmark_strbuf_puts(xml, + " delim=\"paren\""); + } else if (delim == CMARK_PERIOD_DELIM) { + cmark_strbuf_puts(xml, + " delim=\"period\""); + } + break; + case CMARK_BULLET_LIST: + cmark_strbuf_puts(xml, " type=\"bullet\""); + break; + default: + break; + } + cmark_strbuf_printf(xml, " tight=\"%s\"", + (cmark_node_get_list_tight(node) ? + "true" : "false")); + break; case CMARK_NODE_CODE_BLOCK: if (node->as.code.info.len > 0) { cmark_strbuf_puts(xml, " info=\""); |