Debian Codegraph @

ext/xmlpage.c

raw symbols SCIP
1 /*
2 * xmlpage -- write a skeletal xhtml page
3 *
4 * Copyright (C) 2007 David L Parsons.
5 * The redistribution terms are provided in the COPYRIGHT file that must
6 * be distributed with this source code.
7 */
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <markdown.h>
11
12
13 int
14 mkd_xhtmlpage(Document *p, mkd_flag_t flags, FILE *out)
15 {
16 char *title;
17 extern char *mkd_doc_title(Document *);
18
19 if ( mkd_compile(p, flags) ) {
20 DO_OR_DIE( fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
21 "<!DOCTYPE html "
22 " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
23 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
24 "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n") );
25
26 DO_OR_DIE( fprintf(out, "<head>\n") );
27 DO_OR_DIE( fprintf(out, "<title>") );
28 if ( title = mkd_doc_title(p) ) {
29 DO_OR_DIE( fprintf(out, "%s", title) );
30 }
31 DO_OR_DIE( fprintf(out, "</title>\n") );
32 DO_OR_DIE( mkd_generatecss(p, out) );
33 DO_OR_DIE( fprintf(out, "</head>\n"
34 "<body>\n") );
35
36 DO_OR_DIE( mkd_generatehtml(p, out) );
37 DO_OR_DIE( fprintf(out, "</body>\n"
38 "</html>\n") );
39
40 return 0;
41 }
42 return EOF;
43 }