diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2015-09-24 13:17:24 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2015-09-24 15:18:49 +0200 |
commit | 4d1dcf7649bc37535870ac38e958b27c44576fb3 (patch) | |
tree | ccfeecb9fb9d3b357a42fd179eb29084888f2303 | |
parent | c97ba05ef627bfdea79bf925e5728ae27270d25e (diff) | |
download | mupdf-4d1dcf7649bc37535870ac38e958b27c44576fb3.tar.xz |
epub: Add metadata function.
Still a no-op except for returning the document format.
-rw-r--r-- | source/html/epub-doc.c | 9 | ||||
-rw-r--r-- | source/html/html-doc.c | 9 |
2 files changed, 18 insertions, 0 deletions
diff --git a/source/html/epub-doc.c b/source/html/epub-doc.c index a2871889..4610c64a 100644 --- a/source/html/epub-doc.c +++ b/source/html/epub-doc.c @@ -284,6 +284,14 @@ epub_parse_header(fz_context *ctx, epub_document *doc) fz_drop_xml(ctx, content_opf); } +int +epub_lookup_metadata(fz_context *ctx, fz_document *doc_, const char *key, char *buf, int size) +{ + if (!strcmp(key, "format")) + return fz_strlcpy(buf, "EPUB", size); + return -1; +} + static fz_document * epub_init(fz_context *ctx, fz_archive *zip) { @@ -297,6 +305,7 @@ epub_init(fz_context *ctx, fz_archive *zip) doc->super.layout = epub_layout; doc->super.count_pages = epub_count_pages; doc->super.load_page = epub_load_page; + doc->super.lookup_metadata = epub_lookup_metadata; fz_try(ctx) { diff --git a/source/html/html-doc.c b/source/html/html-doc.c index 366a7378..101a4c42 100644 --- a/source/html/html-doc.c +++ b/source/html/html-doc.c @@ -103,6 +103,14 @@ htdoc_load_page(fz_context *ctx, fz_document *doc_, int number) return (fz_page*)page; } +int +htdoc_lookup_metadata(fz_context *ctx, fz_document *doc_, const char *key, char *buf, int size) +{ + if (!strcmp(key, "format")) + return fz_strlcpy(buf, "XHTML", size); + return -1; +} + static fz_document * htdoc_open_document_with_stream(fz_context *ctx, fz_stream *file) { @@ -140,6 +148,7 @@ htdoc_open_document(fz_context *ctx, const char *filename) doc->super.layout = htdoc_layout; doc->super.count_pages = htdoc_count_pages; doc->super.load_page = htdoc_load_page; + doc->super.lookup_metadata = htdoc_lookup_metadata; doc->zip = fz_open_directory(ctx, dirname); doc->set = fz_new_html_font_set(ctx); |