def res(dom): print('> color-syntax.css') io.export_cache('fza/color-syntax.css', SynGenXHTML(dom).colors()) print('> *.css') fnm = io.expand_pj([':', 'forestanza', 'ftype', 'xhtml.css']) with open(fnm) as f: io.export_cache('fza/color-theme-wood.css', f.read()) print('> *.js') fnm = io.expand_pj([':', 'forestanza', 'ftype', 'xhtml.js']) with open(fnm) as f: io.export_cache('fza/scrollPos.js', f.read())
def main(dom, fl): src = fl.name + '.src.html' io.export_cache(src, lambda: web.load(fl.url), keep=True) io.export_cache(fl.name + '.src.txt', lambda: web.refine(io.expand_pj('@/' + src)), keep=True) fts = [fb2, fza, xhtml] exs = [t.Exporter(dom, author='Xz', title=fl.name) for t in fts] # Write main body lst = translated(google.Translator(), fl) for i, line in enumerate(lst): sec = google.ResponseParser(line) for e in exs: e.p_section(i+1, sec) progress_bar(i, fl.N) for t, e in zip(fts, exs): io.export_cache(fl.name + t.EXT, lambda: e.dump())
def main(dom, fl): src = fl.name + '.src.html' io.export_cache(src, lambda: web.load(fl.url), keep=True) io.export_cache(fl.name + '.src.txt', lambda: web.refine(io.expand_pj('@/' + src)), keep=True) fts = [fb2, fza, xhtml] exs = [t.Exporter(dom, author='Xz', title=fl.name) for t in fts] # Write main body lst = translated(google.Translator(), fl) for i, line in enumerate(lst): sec = google.ResponseParser(line) for e in exs: e.p_section(i + 1, sec) progress_bar(i, fl.N) for t, e in zip(fts, exs): io.export_cache(fl.name + t.EXT, lambda: e.dump())
with open(fnm) as f: io.export_cache('fza/scrollPos.js', f.read()) if __name__ == '__main__': tbeg_whole = time.time() args = make_options().parse_args() io.DSTDIR = args.outdir print(">>> Forestanza <<<") dom = ForestanzaDOM(io.import_yaml('colorscheme'), io.import_yaml('lexems-' + 'jap')) res(dom) if args.vimsyntax: for k, v in SynGenVim(dom).ddump(): print('> {}.vim'.format(k)) io.export_cache(k + '.vim', v) for i in args.chapters: tbeg_chap = time.time() fl = Chapter(args, i) if args.remove: io.clean_cache(fl.name) print("\n--- {} ---".format(fl.name)) main(dom, fl) print("= {} s > {}.*".format( time.time() - tbeg_chap, fl.basepath.replace(os.environ['HOME'], '~'))) print("\n=== {} s // Total".format(time.time() - tbeg_whole))
fnm = io.expand_pj([':', 'forestanza', 'ftype', 'xhtml.js']) with open(fnm) as f: io.export_cache('fza/scrollPos.js', f.read()) if __name__ == '__main__': tbeg_whole = time.time() args = make_options().parse_args() io.DSTDIR = args.outdir print(">>> Forestanza <<<") dom = ForestanzaDOM(io.import_yaml('colorscheme'), io.import_yaml('lexems-' + 'jap')) res(dom) if args.vimsyntax: for k, v in SynGenVim(dom).ddump(): print('> {}.vim'.format(k)) io.export_cache(k + '.vim', v) for i in args.chapters: tbeg_chap = time.time() fl = Chapter(args, i) if args.remove: io.clean_cache(fl.name) print("\n--- {} ---".format(fl.name)) main(dom, fl) print("= {} s > {}.*".format(time.time() - tbeg_chap, fl.basepath.replace(os.environ['HOME'], '~'))) print("\n=== {} s // Total".format(time.time() - tbeg_whole))