diff --git a/mxmldoc.c b/mxmldoc.c index 23ecddb..38e70c7 100644 --- a/mxmldoc.c +++ b/mxmldoc.c @@ -182,11 +182,11 @@ static void write_docset(const char *docset, const char *section, const char *t #endif /* __APPLE__ */ static void write_element(FILE *out, mxml_node_t *doc, mxml_node_t *element, int mode); #ifdef HAVE_ZLIB_H -static void write_epub(const char *epubfile, const char *section, const char *title, const char *author, const char *copyright, const char *docversion, const char *cssfile, const char *headerfile, const char *introfile, mxml_node_t *doc, const char *footerfile); +static void write_epub(const char *epubfile, const char *section, const char *title, const char *author, const char *copyright, const char *docversion, const char *cssfile, const char *coverimage, const char *headerfile, const char *introfile, mxml_node_t *doc, const char *footerfile); #endif /* HAVE_ZLIB_H */ static void write_file(FILE *out, const char *file, int mode); static void write_function(FILE *out, int mode, mxml_node_t *doc, mxml_node_t *function, int level); -static void write_html(const char *framefile, const char *section, const char *title, const char *author, const char *copyright, const char *docversion, const char *cssfile, const char *headerfile, const char *introfile, mxml_node_t *doc, const char *footerfile); +static void write_html(const char *framefile, const char *section, const char *title, const char *author, const char *copyright, const char *docversion, const char *cssfile, const char *coverimage, const char *headerfile, const char *introfile, mxml_node_t *doc, const char *footerfile); static void write_html_body(FILE *out, int mode, const char *introfile, mxml_node_t *doc); static void write_html_head(FILE *out, int mode, const char *section, const char *title, const char *author, const char *copyright, const char *docversion, const char *cssfile); static void write_html_toc(FILE *out, const char *title, toc_t *toc, const char *filename, const char *target); @@ -222,6 +222,7 @@ main(int argc, /* I - Number of command-line args */ *framefile = NULL, /* Framed HTML basename */ *headerfile = NULL, /* Header file */ *introfile = NULL, /* Introduction file */ + *coverimage = NULL, /* Cover image file */ *name = NULL, /* Name of manpage */ *path = NULL, /* Path to help file for tokens */ *section = NULL, /* Section/keywords of documentation */ @@ -277,6 +278,18 @@ main(int argc, /* I - Number of command-line args */ else usage(NULL); } + else if (!strcmp(argv[i], "--coverimage") && !coverimage) + { + /* + * Set cover image file... + */ + + i ++; + if (i < argc) + coverimage = argv[i]; + else + usage(NULL); + } else if (!strcmp(argv[i], "--css") && !cssfile) { /* @@ -608,7 +621,7 @@ main(int argc, /* I - Number of command-line args */ */ #ifdef HAVE_ZLIB_H - write_epub(epubfile, section, title ? title : "Documentation", author ? author : "Unknown", copyright ? copyright : "Unknown", docversion ? docversion : "0.0", cssfile, headerfile, introfile, mxmldoc, footerfile); + write_epub(epubfile, section, title ? title : "Documentation", author ? author : "Unknown", copyright ? copyright : "Unknown", docversion ? docversion : "0.0", cssfile, coverimage, headerfile, introfile, mxmldoc, footerfile); #else fputs("mxmldoc: Sorry, not compiled with EPUB support.\n", stderr); #endif /* HAVE_ZLIB_H */ @@ -619,7 +632,7 @@ main(int argc, /* I - Number of command-line args */ * Write HTML documentation... */ - write_html(framefile, section, title ? title : "Documentation", author ? author : "Unknown", copyright ? copyright : "Unknown", docversion ? docversion : "0.0", cssfile, headerfile, introfile, mxmldoc, footerfile); + write_html(framefile, section, title ? title : "Documentation", author ? author : "Unknown", copyright ? copyright : "Unknown", docversion ? docversion : "0.0", cssfile, coverimage, headerfile, introfile, mxmldoc, footerfile); break; case OUTPUT_MAN : @@ -3786,6 +3799,7 @@ write_epub(const char *epubfile, /* I - EPUB file (output) */ const char *copyright, /* I - Copyright */ const char *docversion, /* I - Document version */ const char *cssfile, /* I - Stylesheet file */ + const char *coverimage, /* I - Cover image file */ const char *headerfile, /* I - Header file */ const char *introfile, /* I - Intro file */ mxml_node_t *doc, /* I - XML documentation */ @@ -3840,6 +3854,9 @@ write_epub(const char *epubfile, /* I - EPUB file (output) */ write_html_head(fp, OUTPUT_EPUB, section, title, author, copyright, docversion, cssfile); + if (coverimage) + fputs("