44 lines
1.1 KiB
Python
44 lines
1.1 KiB
Python
#!/usr/bin/env python
|
|
# encoding: utf-8
|
|
|
|
"""
|
|
Producing and compiling reports
|
|
"""
|
|
|
|
from path import Path
|
|
import pytex
|
|
|
|
import logging
|
|
#logger = logging.getLogger(__name__)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
from .filters import includegraphics
|
|
pytex.add_filter("includegraphics", includegraphics)
|
|
# texenv.filters['includegraphics'] = includegraphics
|
|
|
|
pytex.add_pkg_loader("notes_tools.reports", "templates")
|
|
|
|
|
|
def produce_compile(template, datas, target, force=1):
|
|
""" Get the template and feed it to create reports
|
|
|
|
:param target: path where the report will be saved
|
|
:param datas: dictonnary to feed the template
|
|
:param template: the template
|
|
"""
|
|
directory = Path(target).dirname()
|
|
datas.update({"directory": directory})
|
|
pytex.feed(template, datas, target, force)
|
|
logger.info(f"{target} has been created")
|
|
pytex.pdflatex(target)
|
|
logger.info(f"{target} has been compiled")
|
|
# pytex.clean()
|
|
# logger.info(f"Clean the directory")
|
|
|
|
|
|
# -----------------------------
|
|
# Reglages pour 'vim'
|
|
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
|
|
# cursor: 16 del
|