diff options
author | Benawi Adha <benawiadha@gmail.com> | 2022-09-24 19:37:59 +0700 |
---|---|---|
committer | Benawi Adha <benawiadha@gmail.com> | 2022-09-24 19:39:10 +0700 |
commit | 3d6cc576607dd523195e5e8444612079645bb274 (patch) | |
tree | 56af604e4a79540f175439fe486d55f8c8a766bb | |
parent | 240cb6dc0f59b5c4f4935d5ac528ed7e0af8481d (diff) | |
download | epy-3d6cc576607dd523195e5e8444612079645bb274.tar.gz |
Revert "Add user setting for indenting paragraphs (#63)"
Issue with inline style (italic, bold)
This reverts commit 240cb6dc0f59b5c4f4935d5ac528ed7e0af8481d.
-rwxr-xr-x | epy.py | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -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 |