added whole system from ola4doc

This commit is contained in:
Bachir Soussi Chiadmi
2017-12-14 17:06:06 +01:00
parent 9646c74be1
commit 0611418f7a
8725 changed files with 817688 additions and 2 deletions
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import pypandoc
import sys, os, shutil
def main():
# create main html dom from template
template_f = open("template.html", "r")
template_html = template_f.read()
template_dom = BeautifulSoup(template_html, 'html.parser')
pdoc_args = ['--mathjax',
'--smart']
pdoc_filters = []
output = pypandoc.convert_file("log.OSP",
to='html5',
format='markdown+header_attributes+link_attributes+bracketed_spans',
extra_args=pdoc_args,
filters=pdoc_filters)
# outputfile=out_f)
# print("output :\n"+output)
output_dom = BeautifulSoup(output, 'html.parser')
log = template_dom.find('div', {'class':'log'})
log.append(output_dom)
# create main html file from filled template html dom
book_html_f = os.path.join('final.html')
with open(book_html_f, 'w') as fp:
fp.write(template_dom.prettify(formatter=None))
if __name__ == "__main__":
main()