From 3d6cc576607dd523195e5e8444612079645bb274 Mon Sep 17 00:00:00 2001 From: Benawi Adha Date: Sat, 24 Sep 2022 19:37:59 +0700 Subject: Revert "Add user setting for indenting paragraphs (#63)" Issue with inline style (italic, bold) This reverts commit 240cb6dc0f59b5c4f4935d5ac528ed7e0af8481d. --- epy.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/epy.py b/epy.py index ee7362e..d73389d 100755 --- a/epy.py +++ b/epy.py @@ -356,7 +356,6 @@ class Settings: SeamlessBetweenChapters: bool = False PreferredTTSEngine: Optional[str] = None TTSEngineArgs: List[str] = field(default_factory=list) - ParaIndent: int = 0 @dataclass(frozen=True) @@ -1095,7 +1094,7 @@ class HTMLtoLines(HTMLParser): groups[row] = [block] return groups - def __init__(self, sects={""}, paraindent=0): + def __init__(self, sects={""}): HTMLParser.__init__(self) self.text = [""] self.ishead = False @@ -1113,7 +1112,6 @@ class HTMLtoLines(HTMLParser): self.italic_marks: List[TextMark] = [] self.bold_marks: List[TextMark] = [] self.imgs: Dict[int, str] = dict() - self.paraindent: int = paraindent def handle_starttag(self, tag, attrs): if re.match("h[1-6]", tag) is not None: @@ -1295,8 +1293,7 @@ class HTMLtoLines(HTMLParser): ] text += [""] else: - text += textwrap.wrap(line, textwidth, initial_indent=' '*self.paraindent) - text += [""] * (self.paraindent == 0) + text += textwrap.wrap(line, textwidth) + [""] endline = len(text) # -1 @@ -1886,7 +1883,6 @@ def parse_html( textwidth: Optional[int] = None, section_ids: Optional[Set[str]] = None, starting_line: int = 0, - paraindent: int = 0 ) -> Union[Tuple[str, ...], TextStructure]: """ Parse html string into TextStructure @@ -1900,7 +1896,7 @@ def parse_html( if not section_ids: section_ids = set() - parser = HTMLtoLines(section_ids, paraindent) + parser = HTMLtoLines(section_ids) # try: parser.feed(html_src) parser.close() @@ -3083,7 +3079,6 @@ class Reader: content, textwidth=reading_state.textwidth, section_ids=set(toc_entry.section for toc_entry in toc_entries), # type: ignore - paraindent=self.setting.ParaIndent ) return text_structure, toc_entries, contents -- cgit