mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-04 00:33:19 +02:00
DRYer
This commit is contained in:
parent
7c061e3f5f
commit
4174efda6c
1 changed files with 3 additions and 6 deletions
|
|
@ -15,12 +15,9 @@
|
|||
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 _xml_types:
|
||||
return 'xml'
|
||||
for syntax, types in (('html', OEB_DOCS), ('css', OEB_STYLES), ('xml', _xml_types)):
|
||||
if mime in types:
|
||||
return syntax
|
||||
if mime.startswith('text/'):
|
||||
return 'text'
|
||||
if mime.startswith('image/') and mime.partition('/')[-1].lower() in {
|
||||
|
|
|
|||
Loading…
Reference in a new issue