mirror of
https://github.com/Paul-Houser/StartTree.git
synced 2024-11-25 00:33:25 +01:00
wired up prettifyHTML to format the output nicely
This commit is contained in:
parent
6a1067b4cd
commit
3a5db78e88
19
install.py
19
install.py
@ -16,10 +16,9 @@ config_path = home + '/.config/StartTree/config.yaml'
|
|||||||
# get cache path
|
# get cache path
|
||||||
cache_dir = home + '/.cache/StartTree'
|
cache_dir = home + '/.cache/StartTree'
|
||||||
|
|
||||||
def prettifyHTML():
|
def prettifyHTML(html):
|
||||||
html = "<div><h1>Hello</h1></div>"
|
|
||||||
soup = BeautifulSoup(html, 'html.parser')
|
soup = BeautifulSoup(html, 'html.parser')
|
||||||
prettyHTML = print(soup.prettify())
|
prettyHTML = soup.prettify()
|
||||||
return prettyHTML
|
return prettyHTML
|
||||||
|
|
||||||
def setup():
|
def setup():
|
||||||
@ -77,7 +76,7 @@ def print_keys(dictionary):
|
|||||||
|
|
||||||
def gen_list_indices(html_file, file_dict):
|
def gen_list_indices(html_file, file_dict):
|
||||||
for key in file_dict:
|
for key in file_dict:
|
||||||
print(key)
|
print()
|
||||||
|
|
||||||
def gen_col_headers(html_file, file_dict):
|
def gen_col_headers(html_file, file_dict):
|
||||||
for key in file_dict:
|
for key in file_dict:
|
||||||
@ -86,7 +85,7 @@ def gen_col_headers(html_file, file_dict):
|
|||||||
html_file.write(" <ul>\n")
|
html_file.write(" <ul>\n")
|
||||||
|
|
||||||
# generate list indices
|
# generate list indices
|
||||||
gen_list_indices(html_file, file_dict)
|
gen_list_indices(html_file, file_dict[key])
|
||||||
|
|
||||||
html_file.write(" </ul>\n")
|
html_file.write(" </ul>\n")
|
||||||
html_file.write("</li>\n")
|
html_file.write("</li>\n")
|
||||||
@ -111,7 +110,7 @@ def gen_html(file_dict):
|
|||||||
|
|
||||||
# open files
|
# open files
|
||||||
skeleton_html = open('./skeletons/index.html', 'r')
|
skeleton_html = open('./skeletons/index.html', 'r')
|
||||||
cache_html = open(cache_dir + '/index.html', 'w')
|
cache_html = open(cache_dir + '/index.html', 'w+')
|
||||||
|
|
||||||
# copy skeleton_html to cache_html until Column Start comment
|
# copy skeleton_html to cache_html until Column Start comment
|
||||||
lines = skeleton_html.readlines()
|
lines = skeleton_html.readlines()
|
||||||
@ -121,6 +120,14 @@ def gen_html(file_dict):
|
|||||||
else:
|
else:
|
||||||
cache_html.write(line)
|
cache_html.write(line)
|
||||||
|
|
||||||
|
# prettify
|
||||||
|
cache_html.seek(0)
|
||||||
|
pretty_string = cache_html.read()
|
||||||
|
pretty_string = prettifyHTML(pretty_string)
|
||||||
|
cache_html.close()
|
||||||
|
cache_html = open(cache_dir + '/index.html', 'w')
|
||||||
|
cache_html.write(pretty_string)
|
||||||
|
|
||||||
# close files
|
# close files
|
||||||
skeleton_html.close()
|
skeleton_html.close()
|
||||||
cache_html.close()
|
cache_html.close()
|
||||||
|
Loading…
Reference in New Issue
Block a user