import os static = os.listdir("pages/static/") posts = os.listdir("pages/posts") templates = ["header","navbar","body","footer"] for staticPage in static: with open("site/" + staticPage, 'w+') as output: for page in templates: with open ("templates/" + page + ".htm") as template: for line in template: if "%Content%" in line: line = "" with open("pages/static/" + staticPage) as content: for line1 in content: line += "\t\t\t" + line1 output.write(line) def makeGifGallery(): gifs = [] for file in os.listdir('site/images/gifs/customgifs/'): with open("templates/gifwrap.htm") as wrap: for line in wrap: gif = line.replace("%gif%", "images/gifs/customgifs/" + file) gifs.append(gif) with open("pages/posts/gifs.html") as gifstpl: with open("pages/static/gifs.html","w+") as output: output.write('
' + gif + ' | ') if count%3==0: output.write('\n