forked from LiveCarta/BookConverter
add processing of JSON presets
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
from src.book_solver import BookSolver
|
||||
from src.preset_processor import PresetProcessor
|
||||
from src.epub_converter.css_preprocessor import CSSPreprocessor
|
||||
from src.epub_converter.html_epub_preprocessor import HtmlEpubPreprocessor
|
||||
from src.epub_converter.epub_converter import EpubConverter
|
||||
|
||||
|
||||
@@ -14,8 +17,10 @@ class EpubBook(BookSolver):
|
||||
Function
|
||||
Steps
|
||||
----------
|
||||
1. Converts .epub to .html
|
||||
2. Parses from line structure to nested structure
|
||||
1. Gets data from preset structure
|
||||
2. Add preset to html preprocessor
|
||||
3. Converts .epub to .html
|
||||
4. Parses from line structure to nested structure
|
||||
|
||||
Returns
|
||||
----------
|
||||
@@ -23,7 +28,12 @@ class EpubBook(BookSolver):
|
||||
json for LiveCarta platform
|
||||
|
||||
"""
|
||||
preset = PresetProcessor(preset_path="config/presets.json", logger=self.logger_object)\
|
||||
.get_preset_json()
|
||||
css_preprocessor = CSSPreprocessor(logger=self.logger_object)
|
||||
html_preprocessor = HtmlEpubPreprocessor(preset=preset, logger=self.logger_object)
|
||||
json_converter = EpubConverter(
|
||||
self.file_path, access=self.access, logger=self.logger_object)
|
||||
self.file_path, access=self.access, logger=self.logger_object,
|
||||
css_preprocessor=css_preprocessor, html_processor=html_preprocessor)
|
||||
content_dict = json_converter.convert_to_dict()
|
||||
return content_dict
|
||||
|
||||
Reference in New Issue
Block a user