1
0
mirror of https://github.com/gryf/ebook-converter.git synced 2026-04-19 04:33:34 +02:00

Use the real constants module.

This is progressing refactor of the calibre code to make it more
readable, and transform it to something more coherent.

In this patch, there are changes regarding imports for some modules,
instead of polluting namespace of each module with some other modules
symbols, which often were imported from other modules. Yuck.
This commit is contained in:
2020-05-29 17:04:53 +02:00
parent ee4801228f
commit ce89f5c9d1
54 changed files with 2383 additions and 2081 deletions

View File

@@ -1,11 +1,12 @@
"""
Convert an ODT file into a Open Ebook
"""
import os, logging
import logging
import os
from lxml import etree
from css_parser import CSSParser
from css_parser.css import CSSRule
from lxml import etree
from odf.odf2xhtml import ODF2XHTML
from odf.opendocument import load as odLoad
@@ -14,15 +15,9 @@ from odf.namespaces import TEXTNS as odTEXTNS
from ebook_converter import CurrentDir, walk
from ebook_converter.ebooks.oeb.base import _css_logger
from ebook_converter.utils.xml_parse import safe_xml_fromstring
from ebook_converter.polyglot.builtins import as_bytes
__license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
class Extract(ODF2XHTML):
def extract_pictures(self, zf):
@@ -46,7 +41,7 @@ class Extract(ODF2XHTML):
ol.set('start', val)
def fix_markup(self, html, log):
root = safe_xml_fromstring(html)
root = etree.fromstring(html)
self.filter_css(root, log)
self.extract_css(root, log)
self.epubify_markup(root, log)