archive
/
ymd
Archived
1
Fork 0

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
.ropeproject
test.html

View File

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

View File

@ -2,6 +2,8 @@ from jinja2 import Template
import yaml
import markdown
from io import StringIO
import os
from bs4 import BeautifulSoup
def parse_item(item, h):
@ -41,6 +43,9 @@ with open('test.yml') as f:
with StringIO() as 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())