Indentation caused <pre> issues.

This commit is contained in:
Niels G. W. Serup 2016-08-30 18:33:39 +02:00
parent d678c1072c
commit 2d77af19b7
1 changed files with 1 additions and 4 deletions

View File

@ -35,9 +35,6 @@ def pandoc(filename):
proc = subprocess.run(['pandoc', filename], stdout=subprocess.PIPE) proc = subprocess.run(['pandoc', filename], stdout=subprocess.PIPE)
return proc.stdout.decode('utf-8').strip() return proc.stdout.decode('utf-8').strip()
def indent_block(t, block):
return '\n'.join(t + line for line in block.split('\n'))
def extract_markdown_title(filename): def extract_markdown_title(filename):
with open(filename) as f: with open(filename) as f:
for line in f: for line in f:
@ -49,7 +46,7 @@ def extract_markdown_title(filename):
def markdown_to_html(input_file, output_dir): def markdown_to_html(input_file, output_dir):
title = extract_markdown_title(input_file) title = extract_markdown_title(input_file)
title = html.escape(title) title = html.escape(title)
content = indent_block(8 * ' ', pandoc(input_file)) content = pandoc(input_file)
html_out = template_base.format(title=title, content=content) html_out = template_base.format(title=title, content=content)
output_file = os.path.join( output_file = os.path.join(
output_dir, output_dir,