Start work on KF8 writer

This commit is contained in:
Kovid Goyal 2012-04-12 18:38:43 +05:30
parent 07634194d0
commit 63d578f99b
3 changed files with 37 additions and 0 deletions

View File

@ -153,11 +153,22 @@ class MOBIOutput(OutputFormatPlugin):
def convert(self, oeb, output_path, input_plugin, opts, log):
self.log, self.opts, self.oeb = log, opts, oeb
kf8 = self.create_kf8()
self.write_mobi(input_plugin, output_path, kf8)
def create_kf8(self):
from calibre.ebooks.mobi.writer8.main import KF8Writer
return KF8Writer(self.oeb, self.opts)
def write_mobi(self, input_plugin, output_path, kf8):
from calibre.ebooks.mobi.mobiml import MobiMLizer
from calibre.ebooks.oeb.transforms.manglecase import CaseMangler
from calibre.ebooks.oeb.transforms.rasterize import SVGRasterizer, Unavailable
from calibre.ebooks.oeb.transforms.htmltoc import HTMLTOCAdder
from calibre.customize.ui import plugin_for_input_format
opts, oeb = self.opts, self.oeb
if not opts.no_inline_toc:
tocadder = HTMLTOCAdder(title=opts.toc_title, position='start' if
opts.mobi_toc_at_start else 'end')

View File

@ -0,0 +1,11 @@
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'

View File

@ -0,0 +1,15 @@
#!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
class KF8Writer(object):
def __init__(self, oeb, opts):
self.oeb, self.opts, self.log = oeb, opts, oeb.log