1 unstable release

0.0.1 Sep 19, 2022

#40 in #tera

MIT license

475KB
11K SLoC

LaTera

Use Tera for HTML:

<title>{% block title %}{% endblock title %}</title>
<ul>
{% for user in users %}
  <li><a href="{{ user.url }}">{{ user.username }}</a></li>
{% endfor %}
</ul>
{# a comment #}

Use LaTera for LaTeX:

\section{ <# block section #><# endblock section #> }
\begin{itemize}
  <# for user in users #>
    \item \href{ << user.url >> }{ << user.username >> }
  <# endfor #>
\end{itemize}
<% a comment %>

Objectives

  • Avoid templating issues with curly brackets in your LaTex code
  • Be somewhat compatible with LaTeX syntax highlighting

Changelog

  • Changed block syntax
-variable_start = { "{{-" | "{{" }
-variable_end   = { "-}}" | "}}" }
+variable_start = { "<<-" | "<<" }
+variable_end   = { "->>" | ">>" }
-tag_start      = { "{%-" | "{%" }
-tag_end        = { "-%}" | "%}" }
+tag_start      = { "<#-" | "<#" }
+tag_end        = { "-#>" | "#>" }
-comment_start  = { "{#-" | "{#" }
-comment_end    = { "-#}" | "#}" }
+comment_start  = { "<%-" | "<%" }
+comment_end    = { "-%>" | "%>" }
  • Rewrite tests
  • Escape text for LaTeX, not HTML

Dependencies

~6–16MB
~206K SLoC