From e036375cff96ffe14603cdcd1fc133c5e4dd2640 Mon Sep 17 00:00:00 2001 From: David Parsons Date: Sat, 4 Oct 2008 13:36:17 -0700 Subject: [PATCH] Add a demo program for mkd_xhtmlpage(), add it to the sample programs list. --- Makefile.in | 2 +- makepage.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 makepage.c diff --git a/Makefile.in b/Makefile.in index 7472419..8467db5 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,7 +8,7 @@ LIBDIR=@libdir@ INCDIR=@prefix@/include PGMS=markdown -SAMPLE_PGMS=mkd2html +SAMPLE_PGMS=mkd2html makepage @THEME@SAMPLE_PGMS+= theme MKDLIB=libmarkdown.a OBJS=mkdio.o markdown.o dumptree.o generate.o \ diff --git a/makepage.c b/makepage.c new file mode 100644 index 0000000..c606927 --- /dev/null +++ b/makepage.c @@ -0,0 +1,26 @@ +/* + * makepage: Use mkd_xhtmlpage() to convert markdown input to a + * fully-formed xhtml page. + */ +#include +#include +#include + +main(argc, argv) +int argc; +char **argv; +{ + MMIOT *doc; + + if ( (argc > 1) && !freopen(argv[1], "r", stdin) ) { + perror(argv[1]); + exit(1); + } + + if ( (doc = mkd_in(stdin, 0)) == 0 ) { + perror( (argc > 1) ? argv[1] : "stdin" ); + exit(1); + } + + exit(mkd_xhtmlpage(doc, 0, stdout)); +}