basic pretty working with string

This commit is contained in:
gideonwolfe 2020-08-24 00:47:36 -07:00
parent 05ab6f624d
commit ebdd91f526

View File

@ -4,6 +4,7 @@ import yaml
import os import os
from os.path import expanduser from os.path import expanduser
from shutil import copyfile from shutil import copyfile
from bs4 import BeautifulSoup
# get home directory # get home directory
home = expanduser("~") home = expanduser("~")
@ -15,6 +16,12 @@ 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():
html = "<div><h1>Hello</h1></div>"
soup = BeautifulSoup(html, 'html.parser')
prettyHTML = print(soup.prettify())
return prettyHTML
def setup(): def setup():
# check if .config path exists # check if .config path exists
if not os.path.isdir(home + '/.config'): if not os.path.isdir(home + '/.config'):
@ -76,7 +83,7 @@ def gen_html():
# 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()
@ -86,12 +93,16 @@ def gen_html():
else: else:
cache_html.write(line) cache_html.write(line)
prettifyHTML()
# close files # close files
skeleton_html.close() skeleton_html.close()
cache_html.close() cache_html.close()
print("Done!") print("Done!")
if __name__ == '__main__': if __name__ == '__main__':
setup() setup()
file_dict = parse_yaml() file_dict = parse_yaml()