mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Edit book: Fix error when prettying HTML files that contain un-indented <script> or <style> tags
This commit is contained in:
parent
3c5f62d040
commit
1829e4f1eb
@ -118,9 +118,9 @@ def indent_for_tag(x):
|
|||||||
prev = x.getprevious()
|
prev = x.getprevious()
|
||||||
x = x.getparent().text if prev is None else prev.tail
|
x = x.getparent().text if prev is None else prev.tail
|
||||||
if not x:
|
if not x:
|
||||||
return None
|
return ''
|
||||||
s = x.rpartition('\n')[-1]
|
s = x.rpartition('\n')[-1]
|
||||||
return s if isspace(s) else None
|
return s if isspace(s) else ''
|
||||||
|
|
||||||
def set_indent(elem, attr, indent):
|
def set_indent(elem, attr, indent):
|
||||||
x = getattr(elem, attr)
|
x = getattr(elem, attr)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user