Text::Markdown::Discount
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

49 lines
1.1 KiB

/*
* xmlpage -- write a skeletal xhtml page
*
* Copyright (C) 2007 David L Parsons.
* The redistribution terms are provided in the COPYRIGHT file that must
* be distributed with this source code.
*/
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include "cstring.h"
#include "markdown.h"
#include "amalloc.h"
int
mkd_xhtmlpage(Document *p, int flags, FILE *out)
{
char *title;
extern char *mkd_doc_title(Document *);
if ( mkd_compile(p, flags) ) {
fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
fprintf(out, "<!DOCTYPE html "
" PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
fprintf(out, "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n");
fprintf(out, "<head>\n");
if ( title = mkd_doc_title(p) )
fprintf(out, "<title>%s</title>\n", title);
mkd_style(p, out);
fprintf(out, "</head>\n");
fprintf(out, "<body>\n");
mkd_generatehtml(p, out);
fprintf(out, "</body>\n");
mkd_cleanup(p);
fprintf(out, "</html>\n");
return 0;
}
return -1;
}