forked from LiveCarta/BookConverter
Annotations in Epub converter
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import re
|
||||
from typing import Union
|
||||
from typing import List, Dict, Union
|
||||
|
||||
from ebooklib.epub import Section, Link
|
||||
from src.livecarta_config import LiveCartaConfig
|
||||
@@ -11,7 +11,7 @@ class NavPoint:
|
||||
These are data structures which form mapping from NCX to python data structures.
|
||||
"""
|
||||
|
||||
def __init__(self, obj: Union[Link, Section] = None, ):
|
||||
def __init__(self, obj: Union[Link, Section] = None):
|
||||
self.href, self.id = self.parse_href_id(obj)
|
||||
self.title = obj.title
|
||||
|
||||
@@ -52,15 +52,15 @@ def flatten(x):
|
||||
class ChapterItem:
|
||||
"""
|
||||
Class of Chapter that could have subchapters
|
||||
These are data structures which form mapping to livecarta json structure.
|
||||
These are data structures which form mapping to LiveCarta json structure.
|
||||
"""
|
||||
|
||||
def __init__(self, title, content, sub_items):
|
||||
def __init__(self, title: str, content: str, sub_items: List):
|
||||
self.title = title
|
||||
self.content = content
|
||||
self.sub_items = sub_items
|
||||
|
||||
def to_dict(self, lvl=1):
|
||||
def to_dict(self, lvl: int = 1) -> Dict[str, Union[str, List]]:
|
||||
"""Function returns dictionary of chapter"""
|
||||
sub_dicts = []
|
||||
if self.sub_items:
|
||||
|
||||
Reference in New Issue
Block a user