converter fix: add text-indent if \t in the start of <p>

This commit is contained in:
shirshasa
2020-12-02 16:43:22 +03:00
parent efea215c48
commit 718f81b124

View File

@@ -148,9 +148,14 @@ class HTMLPreprocessor:
# there we remove 1 unnecessary <br>
brs = p.find_all('br')
text = p.text
if brs and text == '\n\n' and len(brs) == 2:
brs[0].decompose()
indent_should_be_added = False
if text and ((text[0:1] == '\t') or (text[:2] == '\n\t')):
indent_should_be_added = True
align = p.get('align')
style = p.get('style')
@@ -178,8 +183,8 @@ class HTMLPreprocessor:
if align is not None and align != LawCartaConfig.DEFAULT_ALIGN_STYLE:
style += f'text-align: {align};'
if indent is not None:
indent = indent.group(1)
if indent is not None or indent_should_be_added:
# indent = indent.group(1)
style += f'text-indent: {LawCartaConfig.INDENT};'
if style: