diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-12-29 12:54:27 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-12-29 12:54:27 -0800 |
commit | 5f88071c82769d557062ea574a42eab700a28c4b (patch) | |
tree | 350a664c512043684a4d7a35b5a2f872a62872ec /src/xml.c | |
parent | 0566fa09cf2369cef3ea6b459f3d4fcf3a27d0fc (diff) |
Make `--sourcepos` affect xml writer too.
Diffstat (limited to 'src/xml.c')
-rw-r--r-- | src/xml.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -35,7 +35,8 @@ static inline void indent(struct render_state *state) } static int -S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate) +S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate, + long options) { struct render_state *state = vstate; cmark_strbuf *xml = state->xml; @@ -48,7 +49,7 @@ S_render_node(cmark_node *node, cmark_event_type ev_type, void *vstate) cmark_strbuf_printf(xml, "<%s", cmark_node_get_type_string(node)); - if (node->start_line != 0) { + if (options & CMARK_OPT_SOURCEPOS && node->start_line != 0) { cmark_strbuf_printf(xml, " sourcepos=\"%d:%d-%d:%d\"", node->start_line, node->start_column, @@ -135,7 +136,7 @@ char *cmark_render_xml(cmark_node *root, long options) "<!DOCTYPE CommonMark SYSTEM \"CommonMark.dtd\">\n"); while ((ev_type = cmark_iter_next(iter)) != CMARK_EVENT_DONE) { cur = cmark_iter_get_node(iter); - S_render_node(cur, ev_type, &state); + S_render_node(cur, ev_type, &state, options); } result = (char *)cmark_strbuf_detach(&xml); |