#!bin/env/python relative_path = "html-templates/" output_path = "output/" content_files = ["template-student.html","template-kontakt.html", "template-schueler.html", "template-fsr.html", "template-index.html"] def create_website(current_content_file): nameparts = current_content_file.split("-") file = open(output_path + nameparts[1],"w") file.write("") file_site = open(relative_path + "template-site.html", "r") file_nav = open(relative_path + "template-nav.html", "r") file_footer = open(relative_path + "template-footer.html", "r") for line in file_site: if "{{nav}}" in line: file.write(file_nav.read()) elif "{{content}}" in line: file_content = open(relative_path + current_content_file) file.write(file_content.read()) elif "{{footer}}" in line: file.write(file_footer.read()) else: file.write(line) file.close() print nameparts[1] for current_content_file in content_files: create_website(current_content_file)