Skip to content
Permalink
Browse files

make lxml reformat HTML

  • Loading branch information
ralsina committed May 14, 2015
1 parent 691fc61 commit 67ebf2187761e46fbddb8ff79370b46d55f401f0
Showing with 2 additions and 1 deletion.
  1. +2 −1 nikola/nikola.py
@@ -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:

0 comments on commit 67ebf21

Please sign in to comment.