def register_from_cache(): version = ".".join(pantondoc.pandoc.PandocInfo().mayor_version) for path in (version, "user"): try: with open(plugin_path() + "/plugin/pantondoc/executors/" + path) as ifile: executors = filter(lambda i: i.strip(), ifile.readlines()) map(lambda i: register_executor(i, False), executors) except: pass
def register_executor(executor, user=True): if executor.__class__ == str: executor = Executor(executor) if user and executor not in pantondoc_executors and vim.eval("g:pantondoc_executors_save_new") == '1': try: #add a reference string to /plugin/pantondoc/executors/user with open(plugin_path() + "/plugin/pantondoc/executors/user", "a") as ofile: ofile.write(str(executor) + "\n") except: pass pantondoc_executors.add(executor)
def register_executor(executor, user=True): if executor.__class__ == str: executor = Executor(executor) if user and executor not in pantondoc_executors and vim.eval( "g:pantondoc_executors_save_new") == '1': try: #add a reference string to /plugin/pantondoc/executors/user with open(plugin_path() + "/plugin/pantondoc/executors/user", "a") as ofile: ofile.write(str(executor) + "\n") except: pass pantondoc_executors.add(executor)