Generate Text and Documents with the Tera Templating Engine

The 'tera' package uses 'extendr' to provide access to Vincent Prouillet's 'Tera' templating engine in Rust. Users mainly interact with a Tera R6 object, which serves as a template library with encapsulated methods for rendering templates with a given context. Template syntax supports additional logic, including built-in filters, tests, and functions, as well as loops, conditions, and inheritance. Documentation for Tera's templating syntax can be found at < https://keats.github.io/tera/>.


tera

R-CMD-check CRANstatus extendr

The tera package uses extendr to provide access to Vincent Prouillet’s Tera templating engine in Rust. Users mainly interact with a Tera R6 object, which serves as a template library with encapsulated methods for rendering templates with a given context. Template syntax supports additional logic, including built-in filters, tests, and functions, as well as loops, conditions, and inheritance. Documentation for Tera’s templating syntax can be found at https://keats.github.io/tera/.

Installation

The published CRAN version:

install.packages("tera")

The development version:

# install.packages("pak")
pak::pak("kbvernon/tera-r")

Usage

Here is a simple hello-world example:

library(tera)

tera <- Tera$new()

tera$render_string(
  '<p>Hello {{ x }}. This is {{ y }}.</p>',
  x = "world",
  y = "tera"
)
#> [1] "<p>Hello world. This is tera.</p>"

To learn more, check out the Getting started article on the package website, or call vignette("tera").

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("tera")

0.1.0 by Kenneth Blake Vernon, 21 days ago


https://github.com/kbvernon/tera-r, https://kbvernon.github.io/tera-r/


Browse source code at https://github.com/cran/tera


Authors: Kenneth Blake Vernon [aut, cre, cph] (ORCID:


Documentation:   PDF Manual  


MIT + file LICENSE license


Imports cli, R6, rlang, yyjsonr

Suggests knitr, quarto, rmarkdown, testthat, withr

System requirements: Cargo (Rust's package manager), rustc


See at CRAN