repytex/notes_tools/generate_bilan/texenv.py
Benjamin Bertrand 34546914e5 add plot filters
2016-11-26 16:53:06 +03:00

45 lines
1.2 KiB
Python

#!/usr/bin/env python
# encoding: utf-8
import jinja2, os
from .filters import includegraphics
__all__ = ["texenv"]
# Definition of jinja syntax for latex
texenv = jinja2.Environment(
block_start_string = '\Block{',
# Gros WTF!! Si on le met en maj ça ne marche pas alors que c'est en maj dans le template...
block_end_string = '}',
variable_start_string = '\Var{',
variable_end_string = '}',
comment_start_string = '\#{',
comment_end_string = '}',
line_statement_prefix = '%-',
line_comment_prefix = '%#',
loader = jinja2.ChoiceLoader([jinja2.PackageLoader("notes_tools.generate_bilan", "templates"),
jinja2.FileSystemLoader(['./']),
]),
extensions = ['jinja2.ext.do']
)
# Filters
from .filters import includegraphics
texenv.filters['includegraphics'] = includegraphics
from notes_tools.tools.marks_plottings import comp_radar, marks_hist
texenv.filters['comp_radar'] = comp_radar
texenv.filters['marks_hist'] = marks_hist
if __name__ == '__main__':
print(texenv.list_templates())
texenv.get_template("tpl_bilan.tex")
# -----------------------------
# Reglages pour 'vim'
# vim:set autoindent expandtab tabstop=4 shiftwidth=4:
# cursor: 16 del