|
@@ -42,8 +42,6 @@ erlydtl:compile_template("<html>{{ foo }}</html>", my_module_name, Options)
|
|
Result:
|
|
Result:
|
|
|
|
|
|
```erlang
|
|
```erlang
|
|
-ok %% existing compiled template is up to date.
|
|
|
|
-
|
|
|
|
{ok, Module}
|
|
{ok, Module}
|
|
{ok, Module, Warnings}
|
|
{ok, Module, Warnings}
|
|
{ok, Module, Binary}
|
|
{ok, Module, Binary}
|
|
@@ -217,6 +215,8 @@ Usage (of a compiled template)
|
|
------------------------------
|
|
------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
+### render/1
|
|
|
|
+
|
|
```erlang
|
|
```erlang
|
|
my_compiled_template:render(Variables) -> {ok, IOList} | {error, Err}
|
|
my_compiled_template:render(Variables) -> {ok, IOList} | {error, Err}
|
|
```
|
|
```
|
|
@@ -228,6 +228,8 @@ can be atoms, strings, binaries, or (nested) variables.
|
|
IOList is the rendered template.
|
|
IOList is the rendered template.
|
|
|
|
|
|
|
|
|
|
|
|
+### render/2
|
|
|
|
+
|
|
```erlang
|
|
```erlang
|
|
my_compiled_template:render(Variables, Options) -> {ok, IOList} | {error, Err}
|
|
my_compiled_template:render(Variables, Options) -> {ok, IOList} | {error, Err}
|
|
```
|
|
```
|
|
@@ -244,6 +246,8 @@ Same as `render/1`, but with the following options:
|
|
`blocktrans_fun` compile-time option.
|
|
`blocktrans_fun` compile-time option.
|
|
|
|
|
|
|
|
|
|
|
|
+### translatable_strings/0
|
|
|
|
+
|
|
```erlang
|
|
```erlang
|
|
my_compiled_template:translatable_strings() -> [String]
|
|
my_compiled_template:translatable_strings() -> [String]
|
|
```
|
|
```
|
|
@@ -251,6 +255,8 @@ my_compiled_template:translatable_strings() -> [String]
|
|
List of strings appearing in `{% trans %}` and `_(..)` tags.
|
|
List of strings appearing in `{% trans %}` and `_(..)` tags.
|
|
|
|
|
|
|
|
|
|
|
|
+### translated_blocks/0
|
|
|
|
+
|
|
```erlang
|
|
```erlang
|
|
my_compiled_template:translated_blocks() -> [String]
|
|
my_compiled_template:translated_blocks() -> [String]
|
|
```
|
|
```
|
|
@@ -262,6 +268,8 @@ translatable blocks before compile-time, use the provided
|
|
`blocktrans_extractor` module.
|
|
`blocktrans_extractor` module.
|
|
|
|
|
|
|
|
|
|
|
|
+### source/0
|
|
|
|
+
|
|
```erlang
|
|
```erlang
|
|
my_compiled_template:source() -> {FileName, CheckSum}
|
|
my_compiled_template:source() -> {FileName, CheckSum}
|
|
```
|
|
```
|
|
@@ -269,6 +277,8 @@ my_compiled_template:source() -> {FileName, CheckSum}
|
|
Name and checksum of the original template file.
|
|
Name and checksum of the original template file.
|
|
|
|
|
|
|
|
|
|
|
|
+### dependencies/0
|
|
|
|
+
|
|
```erlang
|
|
```erlang
|
|
my_compiled_template:dependencies() -> [{FileName, CheckSum}]
|
|
my_compiled_template:dependencies() -> [{FileName, CheckSum}]
|
|
```
|
|
```
|
|
@@ -278,13 +288,15 @@ file. Useful for frameworks that recompile a template only when the
|
|
template's dependencies change.
|
|
template's dependencies change.
|
|
|
|
|
|
|
|
|
|
|
|
+### variables/0
|
|
|
|
+
|
|
```erlang
|
|
```erlang
|
|
my_compiled_template:variables() -> [Variable::atom()]
|
|
my_compiled_template:variables() -> [Variable::atom()]
|
|
```
|
|
```
|
|
|
|
|
|
Sorted list of unique variables used in the template's body. The list
|
|
Sorted list of unique variables used in the template's body. The list
|
|
can be used for determining which variable bindings need to be passed
|
|
can be used for determining which variable bindings need to be passed
|
|
-to the render/3 function.
|
|
|
|
|
|
+to the `render/3` function.
|
|
|
|
|
|
|
|
|
|
Differences from standard Django Template Language
|
|
Differences from standard Django Template Language
|