Python Library REQ-IF
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

macros.tex 1.2KB

12345678910111213
  1. {%- macro requirement_filter(text) -%}{{ text.replace('<', '$<$').replace('>', '$>$').replace('_', '\\_') }}
  2. {%- endmacro -%}
  3. {%- macro latex_filter(text) -%}{{ requirement_filter(text.replace('"', '\'')).replace('/xc2/xb0', '$^\circ$').replace('/', '/\\allowbreak ').replace('&', '\\allowbreak \\&').replace('->', '$\\rightarrow$').replace('<-', '$\\leftarrow$').replace('=>', '$\\Rightarrow$').replace('<=', '$\\leq$').replace('>=', '$\\geq$').replace('{', '\{').replace('}', '\}').replace('#', '\\#')}}
  4. {%- endmacro -%}
  5. {%- macro color_by_level(level) -%}{% if level <= 10 %}black{% else %}{% if level <= 20 %}green{% else %}{% if level <= 30 %}orange{% else %}red{% endif %}{% endif %}{% endif %}
  6. {%- endmacro -%}
  7. {%- macro bg_by_levelno(level) -%}{% if level <= 10 %}0.8 0.8 0.8{% else %}{% if level <= 20 %}0.8 0.95 0.8{% else %}{% if level <= 30 %}1 0.75 0.45{% else %}0.95 0.8 0.8{% endif %}{% endif %}{% endif %}
  8. {%- endmacro -%}
  9. {%- macro result(level) -%}{% if level <= 10 %}Info{% else %}{% if level <= 20 %}\textcolor{green}{Success}{% else %}{% if level <= 30 %}\textcolor{orange}{Warning}{% else %}\textcolor{red}{Failed}{% endif %}{% endif %}{% endif %}
  10. {%- endmacro -%}