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

  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. #include "cstring.h"
  13. #include "markdown.h"
  14. #include "amalloc.h"
  15. int
  16. mkd_xhtmlpage(Document *p, int flags, FILE *out)
  17. {
  18. char *title;
  19. extern char *mkd_doc_title(Document *);
  20. if ( mkd_compile(p, flags) ) {
  21. fprintf(out, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
  22. fprintf(out, "<!DOCTYPE html "
  23. " PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\""
  24. " \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n");
  25. fprintf(out, "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\" lang=\"en\">\n");
  26. fprintf(out, "<head>\n");
  27. if ( title = mkd_doc_title(p) )
  28. fprintf(out, "<title>%s</title>\n", title);
  29. mkd_style(p, out);
  30. fprintf(out, "</head>\n");
  31. fprintf(out, "<body>\n");
  32. mkd_generatehtml(p, out);
  33. fprintf(out, "</body>\n");
  34. mkd_cleanup(p);
  35. fprintf(out, "</html>\n");
  36. return 0;
  37. }
  38. return -1;
  39. }