Format output code

This commit is contained in:
Jake Howard 2017-03-14 19:57:13 +00:00
parent 93c0714d47
commit ccb11d4f2a
3 changed files with 10 additions and 2 deletions

2
.gitignore vendored
View file

@ -87,3 +87,5 @@ ENV/
# Rope project settings # Rope project settings
.ropeproject .ropeproject
test.html

View file

@ -1,3 +1,4 @@
beautifulsoup4==4.5.3
Jinja2==2.9.5 Jinja2==2.9.5
Markdown==2.6.8 Markdown==2.6.8
PyYAML==3.12 PyYAML==3.12

View file

@ -2,6 +2,8 @@ from jinja2 import Template
import yaml import yaml
import markdown import markdown
from io import StringIO from io import StringIO
import os
from bs4 import BeautifulSoup
def parse_item(item, h): def parse_item(item, h):
@ -41,6 +43,9 @@ with open('test.yml') as f:
with StringIO() as rendered: with StringIO() as rendered:
output(parse_item(formatted[1], 1), rendered) output(parse_item(formatted[1], 1), rendered)
with open('test.html', 'w') as f:
f.write(rendered.getvalue()) soup = BeautifulSoup(rendered.getvalue(), 'html.parser')
os.remove('test.html')
with open('test.html', 'w') as f:
f.write(soup.prettify())