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 @@ -Home · OteraEngine.jl
+Home · OteraEngine.jl
diff --git a/dev/objects.inv b/dev/objects.inv index 13808f1..18d3d35 100644 Binary files a/dev/objects.inv and b/dev/objects.inv differ diff --git a/dev/tutorial/index.html b/dev/tutorial/index.html index cf1a1d0..5fd0c2d 100644 --- a/dev/tutorial/index.html +++ b/dev/tutorial/index.html @@ -9,10 +9,10 @@ julia> txt = "Hello {{ usr }}!" julia> tmp = Template(txt, path = false) julia> init = Dict("usr"=>"OteraEngine") -julia> tmp(init = init)source
Main.OteraEngine.@filterMacro
@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)
source
Main.OteraEngine.@filterMacro
@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
source
WARNING caused by `template_render`

Redefining template_render may generate a warning, but there is currently no problem.

Learn about syntax and configuration in the sections below.

Abstract for Usage

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 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.

Variables

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
source
WARNING caused by `template_render`

Redefining template_render may generate a warning, but there is currently no problem.

Learn about syntax and configuration in the sections below.

Abstract for Usage

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 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.

Variables

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).

Same character 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.

+"dir" => pwd()

configurations can be loaded from TOML file. You don't have to specify all the configurations(The rest uses the default settings).

Same character 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.