OteraEngine.jl
Documentation for OteraEngine.jl.
This package is very very small, but useful. When you use this package with Genie.jl, you can create dynamic and powerful pages.
If you have any questions about this, please write issues on GitHub!
diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index 71fe89d..1e40af1 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-06T15:28:38","documenter_version":"1.7.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-06T15:36:02","documenter_version":"1.7.0"}} \ No newline at end of file diff --git a/dev/index.html b/dev/index.html index b5f1584..12ebb66 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -
Documentation for OteraEngine.jl.
This package is very very small, but useful. When you use this package with Genie.jl, you can create dynamic and powerful pages.
If you have any questions about this, please write issues on GitHub!
Settings
This document was generated with Documenter.jl version 1.7.0 on Wednesday 6 November 2024. Using Julia version 1.11.1.
Documentation for OteraEngine.jl.
This package is very very small, but useful. When you use this package with Genie.jl, you can create dynamic and powerful pages.
If you have any questions about this, please write issues on GitHub!
Settings
This document was generated with Documenter.jl version 1.7.0 on Wednesday 6 November 2024. Using Julia version 1.11.1.
Main.OteraEngine.@filter
— Macro@filter func
This macro registers func
into OteraEngine, then you can use it as a filter(of course you have to pass it to filters argument of Template function). The form of func
should be normal or one-line definition but not lambda.
Example
julia> @filter function greet(x)
+julia> tmp(init = init)
Main.OteraEngine.@filter
— Macro@filter func
This macro registers func
into OteraEngine, then you can use it as a filter(of course you have to pass it to filters argument of Template function). The form of func
should be normal or one-line definition but not lambda.
Example
julia> @filter function greet(x)
return x * "Hello"
end
-julia> @filter say_twice(x) = x*x
Redefining template_render may generate a warning, but there is currently no problem.
Learn about syntax and configuration in the sections below.
Basic syntax of OteraEngine is very similar to one of Jinja2 of Python. You can use OteraEngine for any extension format which has text. There are 4 types of blocks:
{% ... %}
: Control block{{ ... }}
: Expression block{< ... >}
: Julia block{# ... #}
: Comment blockControl block is used for control flow like if
or for
, and Expression block is used for embedding variables. Commend block is just ignored and remove from template. These block must be familiar with those who have ever used jinja2, but OteraEngine has one more block. Julia block makes you possible to write Julia code directly into templates.
As mentioned in previous section, you can embed variables with Expression block. And you can define variables in both templates and julia. Here is an example:
<div>
+julia> @filter say_twice(x) = x*x
sourceRedefining template_render may generate a warning, but there is currently no problem.
Learn about syntax and configuration in the sections below.
Basic syntax of OteraEngine is very similar to one of Jinja2 of Python. You can use OteraEngine for any extension format which has text. There are 4 types of blocks:
{% ... %}
: Control block{{ ... }}
: Expression block{< ... >}
: Julia block{# ... #}
: Comment blockControl block is used for control flow like if
or for
, and Expression block is used for embedding variables. Commend block is just ignored and remove from template. These block must be familiar with those who have ever used jinja2, but OteraEngine has one more block. Julia block makes you possible to write Julia code directly into templates.
As mentioned in previous section, you can embed variables with Expression block. And you can define variables in both templates and julia. Here is an example:
<div>
{% let name = "Julia" %}
Hello {{name}}
{% end %}
@@ -207,4 +207,4 @@
"lstrip_blocks" => false,
"trim_blocks" => false,
"autoescape" => true,
-"dir" => pwd()
configurations can be loaded from TOML file. You don't have to specify all the configurations(The rest uses the default settings).
If you set the same characters into the different items, tokenizer won't be able to work. Even if they matches partially, tokenizer may not work. Moreover, ParserConfig
checks the match between ~_start
and ~_end
, but others not.
Settings
This document was generated with Documenter.jl version 1.7.0 on Wednesday 6 November 2024. Using Julia version 1.11.1.