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
810 B

  1. /*
  2. * docheader -- get values from the document header
  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. static char *
  16. onlyifset(Line *l)
  17. {
  18. char *ret = T(l->text) + l->dle;
  19. return ret[0] ? ret : 0;
  20. }
  21. char *
  22. mkd_doc_title(Document *doc)
  23. {
  24. if ( doc && doc->title )
  25. return onlyifset(doc->title);
  26. return 0;
  27. }
  28. char *
  29. mkd_doc_author(Document *doc)
  30. {
  31. if ( doc && doc->author )
  32. return onlyifset(doc->author);
  33. return 0;
  34. }
  35. char *
  36. mkd_doc_date(Document *doc)
  37. {
  38. if ( doc && doc->date )
  39. return onlyifset(doc->date);
  40. return 0;
  41. }