Home

selftemplating

Selftemplating is a term used in programming and templating systems to describe templates that can produce their own representation or other templates, enabling meta templating or bootstrapping.

The concept sits at the intersection of template processing, metaprogramming, and code generation. It is related

In many systems, templates are composed of static content and dynamic placeholders. Selftemplating arises when the

Examples include a template engine that can render a template language's grammar from a single source file;

Applications and challenges: Useful in bootstrapping, self-hosted template engines, and meta-documentation. Challenges include increasing complexity, risk

to,
but
distinct
from,
a
quine,
which
is
a
program
that
outputs
its
own
source
code;
selftemplating
applies
the
idea
within
the
domain
of
templates
and
templating
engines.
template
includes
a
representation
of
its
own
syntax
or
when
the
rendering
process
produces
a
template
as
output
that
can
be
re-fed
into
the
engine.
Techniques
include
representing
templates
as
data
structures
within
the
language,
recursive
rendering,
and
bootstrapping
where
a
template
engine
is
used
to
generate
its
own
engine
or
starter
templates.
a
template
that
outputs
another
template
with
the
same
placeholders;
and
a
bootstrapping
setup
where
the
first
generated
artifact
is
a
minimal
engine,
followed
by
more
featureful
templates.
of
recursion
errors,
and
security
considerations
when
templates
generate
code.