Total Complexity | 2 |
Total Lines | 36 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from html import escape as html_escape |
||
2 | |||
3 | import jinja2 |
||
4 | from jinja2 import Environment |
||
5 | from jinja2.filters import do_mark_safe |
||
6 | # noinspection PyUnresolvedReferences |
||
7 | from satcfdi.transform.catalog import CATALOGS |
||
8 | |||
9 | environment_default = Environment( |
||
10 | loader=jinja2.FileSystemLoader(searchpath=['templates']), |
||
11 | autoescape=False, |
||
12 | trim_blocks=True, |
||
13 | lstrip_blocks=True, |
||
14 | undefined=jinja2.StrictUndefined, |
||
15 | ) |
||
16 | |||
17 | |||
18 | def finalize_html(val): |
||
19 | return do_mark_safe( |
||
20 | tag(html_escape(val), "b") |
||
21 | ) |
||
22 | |||
23 | |||
24 | environment_bold_escaped = Environment( |
||
25 | loader=jinja2.FileSystemLoader(searchpath=['templates']), |
||
26 | autoescape=True, |
||
27 | trim_blocks=True, |
||
28 | lstrip_blocks=True, |
||
29 | undefined=jinja2.StrictUndefined, |
||
30 | finalize=finalize_html |
||
31 | ) |
||
32 | |||
33 | |||
34 | def tag(text, tag): |
||
35 | return '<' + tag + '>' + text + '</' + tag + '>' |
||
36 |