Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 49 lines (39 sloc) 1.149 kb
e144b9a @vdh Converted discount to 'fake submodule'
vdh authored
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 "config.h"
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <ctype.h>
12
13 #include "cstring.h"
14 #include "markdown.h"
15 #include "amalloc.h"
16
17
18 int
19 mkd_xhtmlpage(Document *p, int flags, FILE *out)
20 {
21 char *title;
22 extern char *mkd_doc_title(Document *);
23
24 if ( mkd_compile(p, flags) ) {
25 fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
26 fprintf(out, "<!DOCTYPE html "
27 " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
28 " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
29
30 fprintf(out, "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n");
31
32 fprintf(out, "<head>\n");
33 if ( title = mkd_doc_title(p) )
34 fprintf(out, "<title>%s</title>\n", title);
35 mkd_generatecss(p, out);
36 fprintf(out, "</head>\n");
37
38 fprintf(out, "<body>\n");
39 mkd_generatehtml(p, out);
40 fprintf(out, "</body>\n");
41 fprintf(out, "</html>\n");
42
43 mkd_cleanup(p);
44
45 return 0;
46 }
47 return -1;
48 }
Something went wrong with that request. Please try again.