summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-29 12:54:27 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-29 12:54:27 -0800
commit5f88071c82769d557062ea574a42eab700a28c4b (patch)
tree350a664c512043684a4d7a35b5a2f872a62872ec /src
parent0566fa09cf2369cef3ea6b459f3d4fcf3a27d0fc (diff)
Make `--sourcepos` affect xml writer too.
Diffstat (limited to 'src')
-rw-r--r--src/xml.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/xml.c b/src/xml.c
index 8f48a12..c0f9d4e 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -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);