Packages

Fast ERLang TEmplate library with bundling support for HTML, JavaScript and CSS files

Current section

Files

Jump to
erlte doc erlte.html
Raw

doc/erlte.html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="ExDoc v0.28.5">
<meta name="project" content="erlte v0.1.0">
<title>erlte — erlte v0.1.0</title>
<link rel="stylesheet" href="dist/erlang-6d8ac4aa7a70488ac182.css" />
<script src="dist/sidebar_items-c34faccec3.js"></script>
<script src="docs_config.js"></script>
<script async src="dist/app-b5f3440501744dc8be3d.js"></script>
</head>
<body data-type="modules">
<script>
try {
var settings = JSON.parse(localStorage.getItem('ex_doc:settings') || '{}');
if (settings.theme === 'dark' ||
((settings.theme === 'system' || settings.theme == null) &&
window.matchMedia('(prefers-color-scheme: dark)').matches)
) {
document.body.classList.add('dark')
}
} catch (error) { }
</script>
<div class="main">
<section class="sidebar">
<button class="sidebar-button sidebar-toggle" aria-label="toggle sidebar">
<i class="ri-menu-line ri-lg" title="Collapse/expand sidebar"></i>
</button>
<form class="sidebar-search" action="search.html">
<button type="submit" class="search-button" aria-label="Submit Search">
<i class="ri-search-2-line" aria-hidden="true" title="Submit search"></i>
</button>
<button type="button" tabindex="-1" class="search-close-button" aria-label="Cancel Search">
<i class="ri-close-line ri-lg" aria-hidden="true" title="Cancel search"></i>
</button>
<label class="search-label">
<p class="sr-only">Search</p>
<input name="q" type="text" class="search-input" placeholder="Search..." aria-label="Input your search terms" autocomplete="off" />
</label>
</form>
<div class="autocomplete">
<div class="autocomplete-results">
</div>
</div>
<div class="sidebar-header">
<div class="sidebar-projectDetails">
<a href="https://github.com/ergenius/erlte" class="sidebar-projectName" translate="no">
erlte
</a>
<strong class="sidebar-projectVersion" translate="no">
v0.1.0
</strong>
</div>
<ul class="sidebar-listNav">
<li><a id="extras-list-link" href="#full-list">Pages</a></li>
<li><a id="modules-list-link" href="#full-list">Modules</a></li>
</ul>
</div>
<div class="gradient"></div>
<ul id="full-list" class="sidebar-fullList"></ul>
</section>
<section class="content">
<output role="status" id="toast"></output>
<div class="content-outer">
<div id="content" class="content-inner">
<h1>
<button class="settings display-settings">
<i class="ri-settings-3-line"></i>
<span class="sr-only">Settings</span>
</button>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L14" title="View Source" class="view-source" rel="help">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
<span translate="no">erlte</span>
<small class="app-vsn" translate="no">(erlte v0.1.0)</small>
</h1>
<section id="summary" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#summary">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this section</span>
</a>
Summary
</h1>
<div class="summary-types summary">
<h2>
<a href="#types">Types</a>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#t:compiled/0" translate="no">compiled/0</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#t:format_specs/0" translate="no">format_specs/0</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#t:node_specs/0" translate="no">node_specs/0</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#t:tags_specs/0" translate="no">tags_specs/0</a>
</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#t:trim_specs/0" translate="no">trim_specs/0</a>
</div>
</div>
</div>
<div class="summary-functions summary">
<h2>
<a href="#functions">Functions</a>
</h2>
<div class="summary-row">
<div class="summary-signature">
<a href="#compile/1" translate="no">compile(Input)</a>
</div>
<div class="summary-synopsis">Compile the specified input with no variables and default format specifications</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#compile/2" translate="no">compile(Input, Variables)</a>
</div>
<div class="summary-synopsis">Compile the specified input with variables and default format specifications</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#compile/3" translate="no">compile(Input, Variables, FormatSpecs)</a>
</div>
<div class="summary-synopsis">Compile the specified input according to the format specification</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#compiled_read_file/1" translate="no">compiled_read_file(Filename)</a>
</div>
<div class="summary-synopsis">Read the compiled template from the specified file</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#compiled_write_file/2" translate="no">compiled_write_file(Filename, Compiled)</a>
</div>
<div class="summary-synopsis">Write the compiled template to the specified file</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#render/1" translate="no">render(Compiled)</a>
</div>
<div class="summary-synopsis">Render the compiled template without replacing any variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#render/2" translate="no">render(Compiled, Variables)</a>
</div>
<div class="summary-synopsis">Render compiled template replacing the specified variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#render_to_compiled/2" translate="no">render_to_compiled(Compiled, Variables)</a>
</div>
<div class="summary-synopsis">Render the compiled template replacing the specified variables and return a new compiled template There is no error return case now but some maybe added in the future so for compatibility reasons you should handle a generic error case too.</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#render_to_file/2" translate="no">render_to_file(Filename, Compiled)</a>
</div>
<div class="summary-synopsis">Render compiled template and save the result into the specified file</div>
</div>
<div class="summary-row">
<div class="summary-signature">
<a href="#render_to_file/3" translate="no">render_to_file(Filename, Compiled, Variables)</a>
</div>
<div class="summary-synopsis">Render compiled template replacing the specified variables and save the result into the specified file</div>
</div>
</div>
</section>
<section id="types" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#types">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this section</span>
</a>
Types
</h1>
<div class="types-list">
<section class="detail" id="t:compiled/0">
<div class="detail-header">
<a href="#t:compiled/0" class="detail-link" title="Link to this type">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this type</span>
</a>
<h1 class="signature" translate="no">compiled/0</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L27" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-type</span> compiled() :: #erlte_compiled{}.</pre>
</div>
</section>
</section>
<section class="detail" id="t:format_specs/0">
<div class="detail-header">
<a href="#t:format_specs/0" class="detail-link" title="Link to this type">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this type</span>
</a>
<h1 class="signature" translate="no">format_specs/0</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L31" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-type</span> format_specs() :: #erlte_format_specs{}.</pre>
</div>
</section>
</section>
<section class="detail" id="t:node_specs/0">
<div class="detail-header">
<a href="#t:node_specs/0" class="detail-link" title="Link to this type">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this type</span>
</a>
<h1 class="signature" translate="no">node_specs/0</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L30" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-type</span> node_specs() :: #erlte_node_specs{}.</pre>
</div>
</section>
</section>
<section class="detail" id="t:tags_specs/0">
<div class="detail-header">
<a href="#t:tags_specs/0" class="detail-link" title="Link to this type">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this type</span>
</a>
<h1 class="signature" translate="no">tags_specs/0</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L29" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-type</span> tags_specs() :: #erlte_tags{}.</pre>
</div>
</section>
</section>
<section class="detail" id="t:trim_specs/0">
<div class="detail-header">
<a href="#t:trim_specs/0" class="detail-link" title="Link to this type">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this type</span>
</a>
<h1 class="signature" translate="no">trim_specs/0</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L28" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-type</span> trim_specs() :: #erlte_trim{}.</pre>
</div>
</section>
</section>
</div>
</section>
<section id="functions" class="details-list">
<h1 class="section-heading">
<a class="hover-link" href="#functions">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this section</span>
</a>
Functions
</h1>
<div class="functions-list">
<section class="detail" id="compile/1">
<div class="detail-header">
<a href="#compile/1" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">compile(Input)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L42" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> compile(Input) -> {ok, Compiled} | {error, Error}
when
Input :: binary() | list() | {file, <a href="https://www.erlang.org/doc/man/file.html#type-name_all">file:name_all</a>()},
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Error :: term().</pre>
</div>
Compile the specified input with no variables and default format specifications
</section>
</section>
<section class="detail" id="compile/2">
<div class="detail-header">
<a href="#compile/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">compile(Input, Variables)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L50" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> compile(Input, Variables) -> {ok, Compiled} | {error, Error}
when
Input :: binary() | list() | {file, <a href="https://www.erlang.org/doc/man/file.html#type-name_all">file:name_all</a>()},
Variables :: list(),
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Error :: term().</pre>
</div>
Compile the specified input with variables and default format specifications
</section>
</section>
<section class="detail" id="compile/3">
<div class="detail-header">
<a href="#compile/3" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">compile(Input, Variables, FormatSpecs)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L59" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> compile(Input, Variables, FormatSpecs) -> {ok, Compiled} | {error, Error}
when
Input :: binary() | list() | {file, <a href="https://www.erlang.org/doc/man/file.html#type-name_all">file:name_all</a>()},
Variables :: list(),
FormatSpecs :: undefined | <a href="erlte.html#t:format_specs/0">erlte:format_specs</a>(),
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Error :: term().</pre>
</div>
Compile the specified input according to the format specification
</section>
</section>
<section class="detail" id="compiled_read_file/1">
<div class="detail-header">
<a href="#compiled_read_file/1" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">compiled_read_file(Filename)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L79" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> compiled_read_file(Filename) -> {ok, Compiled} | {error, Reason}
when
Filename :: <a href="https://www.erlang.org/doc/man/file.html#type-name_all">file:name_all</a>(),
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Reason :: <a href="https://www.erlang.org/doc/man/file.html#type-posix">file:posix</a>() | badarg | terminated | system_limit.</pre>
</div>
Read the compiled template from the specified file
</section>
</section>
<section class="detail" id="compiled_write_file/2">
<div class="detail-header">
<a href="#compiled_write_file/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">compiled_write_file(Filename, Compiled)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L70" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> compiled_write_file(Filename, Compiled) -> ok | {error, Reason}
when
Filename :: <a href="https://www.erlang.org/doc/man/file.html#type-name_all">file:name_all</a>(),
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Reason :: <a href="https://www.erlang.org/doc/man/file.html#type-posix">file:posix</a>() | badarg | terminated | system_limit.</pre>
</div>
Write the compiled template to the specified file
</section>
</section>
<section class="detail" id="render/1">
<div class="detail-header">
<a href="#render/1" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">render(Compiled)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L102" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> render(Compiled) -> {ok, Result} | {error, Error}
when Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(), Result :: binary(), Error :: term().</pre>
</div>
Render the compiled template without replacing any variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.
</section>
</section>
<section class="detail" id="render/2">
<div class="detail-header">
<a href="#render/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">render(Compiled, Variables)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L112" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> render(Compiled, Variables) -> {ok, Result} | {error, Error}
when
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Variables :: list(),
Result :: binary(),
Error :: term().</pre>
</div>
Render compiled template replacing the specified variables There is no error return case now but some maybe added in the future so for compatibility you should handle a generic error case too.
</section>
</section>
<section class="detail" id="render_to_compiled/2">
<div class="detail-header">
<a href="#render_to_compiled/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">render_to_compiled(Compiled, Variables)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L126" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> render_to_compiled(Compiled, Variables) -> {ok, NewCompiled} | {error, Error}
when
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Variables :: list(),
NewCompiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Error :: term().</pre>
</div>
Render the compiled template replacing the specified variables and return a new compiled template There is no error return case now but some maybe added in the future so for compatibility reasons you should handle a generic error case too.
</section>
</section>
<section class="detail" id="render_to_file/2">
<div class="detail-header">
<a href="#render_to_file/2" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">render_to_file(Filename, Compiled)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L138" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> render_to_file(Filename, Compiled) -> {ok, Result} | {error, Reason}
when
Filename :: <a href="https://www.erlang.org/doc/man/file.html#type-name_all">file:name_all</a>(),
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Result :: binary(),
Reason :: <a href="https://www.erlang.org/doc/man/file.html#type-posix">file:posix</a>() | badarg | terminated | system_limit.</pre>
</div>
Render compiled template and save the result into the specified file
</section>
</section>
<section class="detail" id="render_to_file/3">
<div class="detail-header">
<a href="#render_to_file/3" class="detail-link" title="Link to this function">
<i class="ri-link-m" aria-hidden="true"></i>
<span class="sr-only">Link to this function</span>
</a>
<h1 class="signature" translate="no">render_to_file(Filename, Compiled, Variables)</h1>
<a href="https://github.com/ergenius/erlte/blob/v0.1.0/src/erlte.erl#L147" class="view-source" rel="help" title="View Source">
<i class="ri-code-s-slash-line" aria-hidden="true"></i>
<span class="sr-only">View Source</span>
</a>
</div>
<section class="docstring">
<div class="specs">
<pre translate="no"><span class="attribute">-spec</span> render_to_file(Filename, Compiled, Variables) -> {ok, Result} | {error, Reason}
when
Filename :: <a href="https://www.erlang.org/doc/man/file.html#type-name_all">file:name_all</a>(),
Compiled :: <a href="erlte.html#t:compiled/0">erlte:compiled</a>(),
Variables :: undefined | list(),
Result :: binary(),
Reason :: <a href="https://www.erlang.org/doc/man/file.html#type-posix">file:posix</a>() | badarg | terminated | system_limit.</pre>
</div>
Render compiled template replacing the specified variables and save the result into the specified file
</section>
</section>
</div>
</section>
<footer class="footer">
<p>
On Hex.pm:
<span class="line">
<a href="https://hex.pm/packages/erlte/0.1.0" class="line footer-hex-package">Package</a>
<a href="https://preview.hex.pm/preview/erlte/0.1.0" class="line">Preview</a>
<a href="https://preview.hex.pm/preview/erlte/0.1.0/show/src/erlte.erl">(current file)</a>
</span>
<button class="line footer-button display-quick-switch">
Search
</button>
</p>
<p>
Built using
<a href="https://github.com/elixir-lang/ex_doc" title="ExDoc" target="_blank" rel="help noopener" translate="no">ExDoc</a> (v0.28.5) for the
<a href="https://erlang.org" title="Erlang" target="_blank" translate="no">Erlang programming language</a>
</p>
</footer>
</div>
</div>
</section>
</div>
</body>
</html>