Edit book: Fix error when prettying HTML files that contain un-indented <script> or <style> tags

This commit is contained in:
Kovid Goyal 2014-04-05 08:59:30 +05:30
parent 3c5f62d040
commit 1829e4f1eb

View File

@ -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)