summaryrefslogtreecommitdiffhomepage
path: root/documentation/Templates.md
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2015-06-16 10:11:03 +0200
committerJo-Philipp Wich <jow@openwrt.org>2015-06-16 10:11:45 +0200
commit4b11843e4ce3e7636d67cf3e987ae94ca8c8977d (patch)
tree83f266a068949bba4f940965f2f69ca5c63c6622 /documentation/Templates.md
parent37a9d6aee7ad944ea89754c31351ebae961793db (diff)
Add documentation converted from old Trac wiki pages
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'documentation/Templates.md')
-rw-r--r--documentation/Templates.md66
1 files changed, 66 insertions, 0 deletions
diff --git a/documentation/Templates.md b/documentation/Templates.md
new file mode 100644
index 000000000..6affd7fcf
--- /dev/null
+++ b/documentation/Templates.md
@@ -0,0 +1,66 @@
+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 instanciated and each instance can has a different scope. As every template processor. LuCI supports several special markups. Those are enclosed in *<% %>-Tags*.
+
+By adding a *-_' 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.
+
+<<BR>>
+
+
+# Builtin functions and markups
+## Including Lua code
+*Markup:*
+
+ <% code %>
+
+
+
+## Writing variables and function values
+*Syntax:*
+
+ <% write (value) %>
+
+
+*Short-Markup:*
+
+ <%=value%>
+
+
+## Including templates
+*Syntax:*
+
+ <% include (templatename) %>
+
+
+*Short-Markup:*
+
+ <%+templatename%>
+
+
+
+## Translating
+*Syntax:*
+
+ <%= translate("Text to translate") %>
+
+
+
+*Short-Markup:*
+
+ <%:Text to translate%>
+
+
+
+## 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||