import os def create_templates(src: str, dst: str): # get initial working directory iwd = os.getcwd() print('creating dir structure...') # create main dirs try: os.mkdir(src) os.mkdir(dst) except FileExistsError: pass os.chdir(src) # create templates dir os.mkdir('templates') os.chdir('templates') # create article (blog) barebones template os.mkdir('article') with open('article/header.html', 'w+') as f: f.write('\n') f.write('\n') f.write('\n') f.write('\n') f.write('$$TITLE\n') f.write('$$EXTRAHEAD\n') f.write('\n') f.write('\n') with open('article/footer.html', 'w+') as f: f.write('\n') f.write('\n') with open('article/index_header.html', 'w+') as f: f.write('') with open('article/tag_list_header.html', 'w+') as f: f.write('

Tags:') with open('article/tag_entry.html', 'w+') as f: f.write('$$NAME') with open('article/tag_separator.html', 'w+') as f: f.write(', ') with open('article/tag_list_footer.html', 'w+') as f: f.write('

\n') with open('article/article_list_header.html', 'w+') as f: f.write('

Articles

\n') f.write('\n') with open('article/index_footer.html', 'w+') as f: f.write('') with open('article/tag_index_header.html', 'w+') as f: f.write('') with open('article/tag_index_footer.html', 'w+') as f: f.write('') with open('article/article_header.html', 'w+') as f: f.write('

$$TITLE

') with open('article/article_footer.html', 'w+') as f: f.write('') # return to initial working directory os.chdir(iwd) print('done creating dir structure...')