def compile_html(self, source, dest): if txt2tags is None: raise Exception("To build this site, you need to install the " '"txt2tags" package.') try: os.makedirs(os.path.dirname(dest)) except: pass cmd = ["-t", "html", "--no-headers", "--outfile", dest, source] txt2tags(cmd)
def compile_html(self, source, dest): if txt2tags is None: raise Exception('To build this site, you need to install the ' '"txt2tags" package.') try: os.makedirs(os.path.dirname(dest)) except: pass cmd = ["-t", "html", "--no-headers", "--outfile", dest, source] txt2tags(cmd)
def compile(self, source, dest, is_two_file=True, post=None, lang=None): """Compile the source file into HTML and save as dest.""" if txt2tags is None: req_missing(['txt2tags'], 'build this site (compile txt2tags)') makedirs(os.path.dirname(dest)) cmd = ["-t", "html", "--no-headers", "--outfile", dest, source] txt2tags(cmd) with open(dest, 'r', encoding='utf-8') as inf: output, shortcode_deps = self.site.apply_shortcodes(inf.read()) with open(dest, 'w', encoding='utf-8') as outf: outf.write(output) if post is None: if shortcode_deps: self.logger.error( "Cannot save dependencies for post {0} (post unknown)", source) else: post._depfile[dest] += shortcode_deps
def compile(self, source, dest, is_two_file=True, post=None, lang=None): """Compile the source file into HTML and save as dest.""" if txt2tags is None: req_missing(['txt2tags'], 'build this site (compile txt2tags)') makedirs(os.path.dirname(dest)) cmd = ["-t", "html", "--no-headers", "--outfile", dest, source] txt2tags(cmd) with open(dest, 'r', encoding='utf-8') as inf: output, shortcode_deps = self.site.apply_shortcodes(inf.read(), with_dependencies=True) with open(dest, 'w', encoding='utf-8') as outf: outf.write(output) if post is None: if shortcode_deps: self.logger.error( "Cannot save dependencies for post {0} (post unknown)", source) else: post._depfile[dest] += shortcode_deps
def compile_html(self, source, dest, is_two_file=True): if txt2tags is None: req_missing(['txt2tags'], 'build this site (compile txt2tags)') makedirs(os.path.dirname(dest)) cmd = ["-t", "html", "--no-headers", "--outfile", dest, source] txt2tags(cmd) try: post = self.site.post_per_input_file[source] except KeyError: post = None with open(dest, 'r', encoding='utf-8') as inf: output, shortcode_deps = self.site.apply_shortcodes(inf.read(), with_dependencies=True) with open(dest, 'w', encoding='utf-8') as outf: outf.write(output) if post is None: if shortcode_deps: self.logger.error( "Cannot save dependencies for post {0} due to unregistered source file name", source) else: post._depfile[dest] += shortcode_deps
def compile_html(self, source, dest, is_two_file=True): if txt2tags is None: req_missing(['txt2tags'], 'build this site (compile txt2tags)') makedirs(os.path.dirname(dest)) cmd = ["-t", "html", "--no-headers", "--outfile", dest, source] txt2tags(cmd) try: post = self.site.post_per_input_file[source] except KeyError: post = None with open(dest, 'r', encoding='utf-8') as inf: output, shortcode_deps = self.site.apply_shortcodes( inf.read(), with_dependencies=True) with open(dest, 'w', encoding='utf-8') as outf: outf.write(output) if post is None: if shortcode_deps: self.logger.error( "Cannot save dependencies for post {0} due to unregistered source file name", source) else: post._depfile[dest] += shortcode_deps
def compile_html(self, source, dest, is_two_file=True): if txt2tags is None: req_missing(['txt2tags'], 'build this site (compile txt2tags)') makedirs(os.path.dirname(dest)) cmd = ["-t", "html", "--no-headers", "--outfile", dest, source] txt2tags(cmd)