Crates.io | display-as |
lib.rs | display-as |
version | 0.7.0 |
source | src |
created_at | 2018-11-21 17:54:16.127323 |
updated_at | 2022-11-20 13:25:48.164826 |
description | Compile-time templates for displaying data in different markup formats. |
homepage | |
repository | https://github.com/droundy/display-as |
max_upload_size | |
id | 98000 |
size | 54,458 |
These crates creates rusty templates that are evaluated at
compile-time (much like askama).
DisplayAs
is explicitly designed to support multiple output formats
(thus the "as" in its name).
Given there are numerous existing template engines, you might ask what
distinguishes display-as
from these other engines?
The most notable distinction is that display-as
compiles the templates at compile time, like
askama and
ructe but unlike most other
engines.
diplay-as-template
supports (almost) arbitrary rust code in the
template, unlike askama
or ructe. In the case of askama, there is a conscious decision not
to support this. I believe that it is nicer and easier not to
learn a new language for the expressiosn within templates.
DisplayAs
and display-as
support embedding one format
into another, so that you can mix languages. This is most common
in HTML, which supports numerous formats such as javascript or CSS,
but also math mode within either LaTeX or even in HTML using
MathJax. This has been discussed as a
possible feature in ructe.
Using display-as
is typesafe on the output side as well
as the input side. You can't accidentally include javascript
formatted text into HTML, or
double-escape HTML strings.