summaryrefslogtreecommitdiff
path: root/src/xml.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-07 11:17:24 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-07 11:23:29 -0800
commit52c591d75433b16cf32f4fae319ccb60b20f6ae7 (patch)
treeaf0e956b72dfbc3883252f48d3f2138b55aca367 /src/xml.c
parenta29c16c5e283fb50ecd318477072687caf987d4a (diff)
cmark: Add function & option to normalize text nodes.
So, instead of <text>Hi</text> <text>&amp;</text> <text>lo</text> we get <text>Hi&amp;lo</text> * Added exported `cmark_consolidate_text_nodes` function. * Added `CMARK_OPT_NORMALIZE` to options. * Added optional normalization in XML writer. * Added `--normalize` option to command-line program. * Updated man page.
Diffstat (limited to 'src/xml.c')
-rw-r--r--src/xml.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/xml.c b/src/xml.c
index 2ae900c..93a6eda 100644
--- a/src/xml.c
+++ b/src/xml.c
@@ -123,6 +123,11 @@ char *cmark_render_xml(cmark_node *root, long options)
cmark_event_type ev_type;
cmark_node *cur;
struct render_state state = { &xml, 0 };
+
+ if (options & CMARK_OPT_NORMALIZE) {
+ cmark_consolidate_text_nodes(root);
+ }
+
cmark_iter *iter = cmark_iter_new(root);
cmark_strbuf_puts(state.xml,