plasTeX 3.0 — A Python Framework for Processing LaTeX Documents

6.8.1 Templates plugin

The simplest kind of plugin is useful when you need to reuse custom templates. Say you do not like the HTML5 template for quotes and often want to use the same custom template. You can create a folder with the following structure.

\begin{forest} 
  for tree={
    font=\ttfamily,
    grow'=0,
    child anchor=west,
    parent anchor=south,
    anchor=west,
    calign=first,
    edge path={
      \noexpand\path [draw, \forestoption{edge}]
      (!u.south west) +(7.5pt,0) |- node[fill,inner sep=1.25pt] {} (.child anchor)\forestoption{edge label};
    },
    before typesetting nodes={
      if n=1
        {insert before={[,phantom]}}
        {}
    },
    fit=band,
    before computing xy={l=15pt},
  }
[my_templates_plugin
  [pyproject.toml]
  [src
    [plastex_div_quote
      [__init__.py]
      [templates
        [Quote.jinja2]
      ]
    ]
  ]
]
\end{forest}

The ‘pyproject.toml’ was already explained and the ‘__init__.py’ can be empty in this case. In this case the plugin name is plastex_div_quote. The content of ‘Quote.jinja2’ could be:

name: quote
<div class="quote">{{ obj }}</div>