def generate(self, templates): print(' ' + self.shortname + '...', end='') filename = os.path.join(dirs.build, self.get_html_path()) os.makedirs(os.path.split(filename)[0], exist_ok=True) open(filename, 'w').write(util.minify_html(self.get_html(templates))) print('done')
def generate(self, template_list): self.print_message() for i in self.get_images(): i.set_local_root(self.get_local_root(False)) i.set_output_root(self.get_local_output_root(False)) self.hero.set_output_root(self.get_local_output_root(False)) content = util.minify_html(self.generate_html(template_list)) filenames = [] filenames.append(self.path) filenames.append(path.Path('', self.unique_hash + '/index.html')) # for s in self.synonyms: # p = path.Path() # p.copy_from(self.path) # p.set_output_root(os.path.join(util.category_dir(self.category), util.text_to_shortname(s))) # filenames.append(p) for s in self.synonyms: p = path.Path() p.copy_from(self.path) p.set_output_root(os.path.join(util.category_dir(self.category), util.text_to_shortname(s))) os.makedirs(p.get_local_output_root(), exist_ok=True) for filename in filenames: os.makedirs(filename.get_local_output_root(), exist_ok=True) open(filename.get_local_output_path(), 'w').write(content) self.copy_files(self.path)