forked from LiveCarta/BookConverter
epub converter: fix importing
This commit is contained in:
@@ -11,7 +11,7 @@ import pika
|
||||
|
||||
from access import Access
|
||||
from docx_converter import Book
|
||||
from src.epub_converter import EpubBook
|
||||
from epub_converter import EpubBook
|
||||
|
||||
|
||||
def configure_file_logger(name, filename='logs/converter_log.log', filemode='w+',
|
||||
|
||||
@@ -7,8 +7,8 @@ from premailer import transform
|
||||
from itertools import takewhile
|
||||
from logging import CRITICAL
|
||||
|
||||
from src.config import LawCartaConfig
|
||||
from src.util.color_reader import str2color_name
|
||||
from livecarta_config import LawCartaConfig
|
||||
from util.color_reader import str2color_name
|
||||
|
||||
cssutils.log.setLevel(CRITICAL)
|
||||
|
||||
@@ -103,11 +103,6 @@ def check_style_to_be_tag(style):
|
||||
return to_remove
|
||||
|
||||
|
||||
'''
|
||||
LATER:
|
||||
text-transform: uppercase;
|
||||
text-decoration-color: red;
|
||||
'''
|
||||
|
||||
|
||||
def clean_css(css):
|
||||
@@ -7,9 +7,9 @@ import subprocess
|
||||
from subprocess import PIPE
|
||||
from threading import Event
|
||||
|
||||
from bs4 import BeautifulSoup, NavigableString
|
||||
from bs4 import BeautifulSoup
|
||||
|
||||
from config import BookLogger, BookApiWrapper, LawCartaConfig
|
||||
from livecarta_config import BookLogger, BookApiWrapper, LawCartaConfig
|
||||
from html_preprocessor import HTMLPreprocessor
|
||||
from json_postprocessor import JSONConverter
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ import logging
|
||||
import os
|
||||
import pathlib
|
||||
|
||||
from config import BookLogger, BookApiWrapper, LawCartaConfig
|
||||
from src.epub_postprocessor import EpubPostprocessor
|
||||
from livecarta_config import BookLogger, BookApiWrapper, LawCartaConfig
|
||||
from epub_postprocessor import EpubPostprocessor
|
||||
|
||||
|
||||
class EpubBook:
|
||||
|
||||
@@ -9,8 +9,8 @@ from bs4 import BeautifulSoup
|
||||
from ebooklib import epub
|
||||
from ebooklib.epub import Link, Section
|
||||
|
||||
from src.data_objects import ChapterItem, NavPoint
|
||||
from src.html_epub_preprocessor import unwrap_structural_tags, get_tags_between_ids, prepare_title_and_content, \
|
||||
from data_objects import ChapterItem, NavPoint
|
||||
from html_epub_preprocessor import unwrap_structural_tags, get_tags_between_ids, prepare_title_and_content, \
|
||||
update_src_links_in_images, preprocess_footnotes
|
||||
|
||||
# epub3 examples:
|
||||
@@ -27,7 +27,7 @@ from src.html_epub_preprocessor import unwrap_structural_tags, get_tags_between_
|
||||
# поиск toc в epublib:
|
||||
# если в content.opf есть в spine toc атрибут -> можно найти ncx файл -> из него достать navMap
|
||||
# если его там нет, пробуют искать nav tag в manifest -> EpubNav.
|
||||
from src.util.css_reader import clean_css, add_inline_style_to_html_soup
|
||||
from css_reader import clean_css, add_inline_style_to_html_soup
|
||||
|
||||
|
||||
class EpubPostprocessor:
|
||||
|
||||
@@ -5,8 +5,8 @@ from typing import List
|
||||
|
||||
from bs4 import BeautifulSoup, NavigableString, Tag
|
||||
|
||||
from src.access import Access
|
||||
from src.config import LawCartaConfig
|
||||
from access import Access
|
||||
from livecarta_config import LawCartaConfig
|
||||
|
||||
|
||||
def save_image_locally(img_file_path, img_content, book_id):
|
||||
|
||||
@@ -6,7 +6,7 @@ from shutil import copyfile
|
||||
|
||||
from bs4 import BeautifulSoup, NavigableString
|
||||
|
||||
from config import LawCartaConfig, BookLogger, BookApiWrapper
|
||||
from livecarta_config import LawCartaConfig, BookLogger, BookApiWrapper
|
||||
|
||||
|
||||
class HTMLPreprocessor:
|
||||
|
||||
@@ -2,7 +2,7 @@ import logging
|
||||
import re
|
||||
from copy import copy
|
||||
|
||||
from config import LawCartaConfig
|
||||
from livecarta_config import LawCartaConfig
|
||||
|
||||
|
||||
class JSONConverter:
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import logging
|
||||
import os
|
||||
|
||||
from access import Access
|
||||
|
||||
|
||||
class BookLogger:
|
||||
def __init__(self, name, book_id, main_logger=None,
|
||||
Reference in New Issue
Block a user