From 77edd3a7a965d86b3e3197f68358d763d478525b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 28 Jan 2014 10:06:09 +0530 Subject: [PATCH] Edit Book: Enable editing of page map XML files --- src/calibre/ebooks/oeb/polish/check/links.py | 2 ++ src/calibre/gui2/tweak_book/editor/__init__.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/oeb/polish/check/links.py b/src/calibre/ebooks/oeb/polish/check/links.py index a8e7954488..8f6e9bf5e1 100644 --- a/src/calibre/ebooks/oeb/polish/check/links.py +++ b/src/calibre/ebooks/oeb/polish/check/links.py @@ -102,6 +102,8 @@ def check_mimetypes(container): for name, mt in container.mime_map.iteritems(): gt = container.guess_type(name) if mt != gt: + if mt == 'application/oebps-page-map+xml' and name.lower().endswith('.xml'): + continue a(MimetypeMismatch(container, name, mt, gt)) return errors diff --git a/src/calibre/gui2/tweak_book/editor/__init__.py b/src/calibre/gui2/tweak_book/editor/__init__.py index 25cee316af..94215621d4 100644 --- a/src/calibre/gui2/tweak_book/editor/__init__.py +++ b/src/calibre/gui2/tweak_book/editor/__init__.py @@ -16,7 +16,7 @@ def syntax_from_mime(name, mime): return 'html' if mime in OEB_STYLES: return 'css' - if mime in {guess_type('a.opf'), guess_type('a.ncx'), guess_type('a.xml')}: + if mime in {guess_type('a.opf'), guess_type('a.ncx'), guess_type('a.xml'), 'application/oebps-page-map+xml'}: return 'xml' if mime.startswith('text/'): return 'text'