feat: create generate worker
This commit is contained in:
13
bopytex/worker/generate.py
Normal file
13
bopytex/worker/generate.py
Normal file
@@ -0,0 +1,13 @@
|
||||
from jinja2.environment import Template
|
||||
|
||||
|
||||
def generate(args, deps, output):
|
||||
env = args["jinja2"]["environment"]
|
||||
template = env.get_template(deps[0])
|
||||
with open(output, "w") as out:
|
||||
out.write(tpl2tex(template, metas=args))
|
||||
yield f"GENERATE - {deps[0]} to {output}"
|
||||
|
||||
|
||||
def tpl2tex(template: Template, metas: dict = {}) -> str:
|
||||
return template.render(metas)
|
@@ -1,28 +0,0 @@
|
||||
""" A worker consumes tasks """
|
||||
def generate():
|
||||
pass
|
||||
|
||||
|
||||
def compile():
|
||||
pass
|
||||
|
||||
|
||||
def activate_corr():
|
||||
pass
|
||||
|
||||
|
||||
def join_pdf():
|
||||
pass
|
||||
|
||||
|
||||
def clean():
|
||||
pass
|
||||
|
||||
|
||||
WORKERS = {
|
||||
"GENERATE": generate,
|
||||
"COMPILE": compile,
|
||||
"ACTIVATE_CORR": activate_corr,
|
||||
"JOIN_PDF": join_pdf,
|
||||
"CLEAN": clean,
|
||||
}
|
Reference in New Issue
Block a user