Kindle MOBI Files

class bkgen.mobi.MOBI(**args)[source]

Bases: bl.dict.Dict

NS = {‘container’: ‘urn:oasis:names:tc:opendocument:xmlns:container’, ‘cp’: ‘http://schemas.openxmlformats.org/package/2006/metadata/core-properties’, ‘dc’: ‘http://purl.org/dc/elements/1.1/’, ‘dcmitype’: ‘http://purl.org/dc/dcmitype/’, ‘dcterms’: ‘http://purl.org/dc/terms/’, ‘epub’: ‘http://www.idpf.org/2007/ops’, ‘html’: ‘http://www.w3.org/1999/xhtml’, ‘m’: ‘http://www.w3.org/1998/Math/MathML’, ‘ncx’: ‘http://www.daisy.org/z3986/2005/ncx/’, ‘opf’: ‘http://www.idpf.org/2007/opf’, ‘pub’: ‘http://publishingxml.org/ns’, ‘xml’: ‘http://www.w3.org/XML/1998/namespace’, ‘xsi’: ‘http://www.w3.org/2001/XMLSchema-instance’}
build(build_path, metadata, mobi_name=None, manifest=None, spine_items=None, cover_src=None, nav_toc=None, nav_landmarks=None, nav_page_list=None, before_compile=None, nav_href=’nav.html’, nav_title=’Navigation’)[source]

build MOBI (Kindle ebook) output of the given project

compile_mobi(build_path, opffn, mobifn=None, config=Config(‘/home/docs/checkouts/readthedocs.org/user_builds/bkgen/checkouts/latest/bkgen/__config__.ini’))[source]

generate .mobi file using kindlegen

classmethod mobi_fn(mobi_path, mobi_name=None, ext=’.mobi’)[source]
classmethod move_anchors_before_paragraphs(build_path, opffn)[source]

In Kindle ebooks, link targets need to be moved before the containing paragraph so that the paragraph formatting can be displayed properly.

size_images(opffn)[source]

resample images to the width / height specified in the img tag, and remove those size attributes