summaryrefslogtreecommitdiffhomepage
path: root/docs/Templates.md
diff options
context:
space:
mode:
Diffstat (limited to 'docs/Templates.md')
-rw-r--r--docs/Templates.md87
1 files changed, 45 insertions, 42 deletions
diff --git a/docs/Templates.md b/docs/Templates.md
index adf019c01a..ed51bcf4d8 100644
--- a/docs/Templates.md
+++ b/docs/Templates.md
@@ -1,65 +1,68 @@
+## Templates
+
+See [online wiki](https://github.com/openwrt/luci/wiki/Templates) for latest version.
+
LuCI has a simple regex based template processor which parses HTML-files to Lua functions and allows to store precompiled template files.
The simplest form of a template is just an ordinary HTML-file. It will be printed out to the user as is.
-In LuCI every template is an object with an own scope. It can therefore be instantiated and each instance can has a different scope. As every template processor. LuCI supports several special markups. Those are enclosed in `<% %>`-Tags.
+In LuCI every template is an object with an own scope
+It can therefore be instanced and each instance can have a different scope.
+As every template processor. LuCI supports several special markups. Those are enclosed in `<% %>`-Tags.
-By adding `-` (dash) right after the opening `<%` every whitespace before the markup will be stripped. Adding a `-` right before the closing `%>` will equivalently strip every whitespace behind the markup.
+By adding `-` (dash) right after the opening `<%` every whitespace before the markup will be stripped.
+Adding a `-` right before the closing `%>` will equivalently strip every whitespace behind the markup.
-# Builtin functions and markups
-## Including Lua code
+## Builtin functions and markups
+### Including Lua code
*Markup:*
-
- <% code %>
-
+```
+<% code %>
+```
-
-## Writing variables and function values
+### Writing variables and function values
*Syntax:*
-
- <% write (value) %>
-
+```
+<% write (value) %>
+```
*Short-Markup:*
-
- <%=value%>
-
+```
+<%=value%>
+```
-## Including templates
+### Including templates
*Syntax:*
-
- <% include (templatename) %>
-
+```
+<% include (templatename) %>
+```
*Short-Markup:*
-
- <%+templatename%>
-
+```
+<%+templatename%>
+```
-## Translating
+### Translating
*Syntax:*
-
- <%= translate("Text to translate") %>
-
-
+```
+<%= translate("Text to translate") %>
+```
*Short-Markup:*
-
- <%:Text to translate%>
-
+```
+<%:Text to translate%>
+```
-## Commenting
+### Commenting
*Markup:*
-
- <%# comment %>
-
-
-# Builtin constants
-| Name | Value |
----------|---------
-|`REQUEST_URI`|The current URL (without server part)|
-|`controller`|Path to the Luci main dispatcher|
-|`resource`|Path to the resource directory|
-|`media`|Path to the active theme directory|
+```
+<%# comment %>
+```
+
+## Builtin constants
+* `REQUEST_URI`: The current URL (without server part)
+* `controller`: Path to the Luci main dispatcher
+* `resource`: Path to the resource directory
+* `media`: Path to the active theme directory