/* * xmlpage -- write a skeletal xhtml page * * Copyright (C) 2007 Jessica L Parsons. * The redistribution terms are provided in the COPYRIGHT file that must * be distributed with this source code. */ #include #include #include extern char *mkd_doc_title(Document *); #if USE_H1TITLE extern char* mkd_h1_title(Document *); #define DOCUMENT_TITLE(x) mkd_doc_title(x) ? mkd_doc_title(x) : mkd_h1_title(x) #else #define DOCUMENT_TITLE(x) mkd_doc_title(x) #endif int mkd_xhtmlpage(Document *p, mkd_flag_t* flags, FILE *out) { char *title; if ( mkd_compile(p, flags) ) { DO_OR_DIE( fprintf(out, "\n" "\n" "\n") ); DO_OR_DIE( fprintf(out, "\n") ); title = DOCUMENT_TITLE(p); DO_OR_DIE( fprintf(out, "%s", title ? title : "") ); DO_OR_DIE( mkd_generatecss(p, out) ); DO_OR_DIE( fprintf(out, "\n" "\n") ); DO_OR_DIE( mkd_generatehtml(p, out) ); DO_OR_DIE( fprintf(out, "\n" "\n") ); return 0; } return EOF; }