summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-12-27 21:51:30 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-12-28 16:27:00 -0800
commitd57f3952ca8b9aac16db8243539f4c1c5dbf3c93 (patch)
tree21ff4ae66cc5d6130963172df2badb3a77a4930e /src/main.c
parentbf44064d09afd04039058a00c32c1532fb5e2b61 (diff)
Added xml writer, to dump the AST in XML.
This is a work-in-progress. CommonMark.dtd gives the DTD for the generated XML. Closes #53.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index be3d305..be1bfd9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -10,6 +10,7 @@
typedef enum {
FORMAT_NONE,
FORMAT_HTML,
+ FORMAT_XML,
FORMAT_MAN,
FORMAT_AST
} writer_format;
@@ -18,7 +19,7 @@ void print_usage()
{
printf("Usage: cmark [FILE*]\n");
printf("Options:\n");
- printf(" --to, -t FORMAT Specify output format (html, man, ast)\n");
+ printf(" --to, -t FORMAT Specify output format (html, xml, man, ast)\n");
printf(" --help, -h Print usage information\n");
printf(" --version Print version\n");
}
@@ -33,6 +34,9 @@ static void print_document(cmark_node *document, writer_format writer)
case FORMAT_HTML:
result = cmark_render_html(document);
break;
+ case FORMAT_XML:
+ result = cmark_render_xml(document);
+ break;
case FORMAT_MAN:
result = cmark_render_man(document);
break;
@@ -74,6 +78,8 @@ int main(int argc, char *argv[])
writer = FORMAT_MAN;
} else if (strcmp(argv[i], "html") == 0) {
writer = FORMAT_HTML;
+ } else if (strcmp(argv[i], "xml") == 0) {
+ writer = FORMAT_XML;
} else if (strcmp(argv[i], "ast") == 0) {
writer = FORMAT_AST;
} else {