Edit Book: Add another mimetype for xpgt files

This commit is contained in:
Kovid Goyal 2014-07-25 12:45:14 +05:30
parent 5a5b5fb6f2
commit 7c061e3f5f

View File

@ -11,12 +11,15 @@ from PyQt4.Qt import QTextCharFormat
from calibre.ebooks.oeb.base import OEB_DOCS, OEB_STYLES
from calibre.ebooks.oeb.polish.container import guess_type
_xml_types = {'application/oebps-page-map+xml', 'application/vnd.adobe-page-template+xml'} | {
guess_type('a.'+x) for x in ('ncx', 'opf', 'svg', 'xpgt', 'xml')}
def syntax_from_mime(name, mime):
if mime in OEB_DOCS:
return 'html'
if mime in OEB_STYLES:
return 'css'
if mime in {guess_type('a.svg'), guess_type('a.opf'), guess_type('a.ncx'), guess_type('a.xml'), 'application/oebps-page-map+xml', 'application/vnd.adobe-page-template+xml'}:
if mime in _xml_types:
return 'xml'
if mime.startswith('text/'):
return 'text'