Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
make lxml reformat HTML
  • Loading branch information
ralsina committed May 14, 2015
1 parent 691fc61 commit 67ebf21
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nikola/nikola.py
Expand Up @@ -969,7 +969,8 @@ def render_template(self, template_name, output_name, context):
src = "/".join(src.split(os.sep))

utils.makedirs(os.path.dirname(output_name))
doc = lxml.html.document_fromstring(data)
parser = lxml.html.HTMLParser(remove_blank_text=True)
doc = lxml.html.document_fromstring(data, parser)
doc.rewrite_links(lambda dst: self.url_replacer(src, dst, context['lang']))
data = b'<!DOCTYPE html>\n' + lxml.html.tostring(doc, encoding='utf8', method='html', pretty_print=True)
with open(output_name, "wb+") as post_file:
Expand Down

0 comments on commit 67ebf21

Please sign in to comment.