From e503aff5ae41c16b2c0598203b1fed4082ab519d Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Wed, 21 Sep 2011 00:37:31 +0200 Subject: Added license and readme file. --- COPYING | 17 ++++++++++++ README.markdown | 36 ++++++++++++++++++++++++++ docu/nd/Data/ClassHierarchy.nd | Bin 385 -> 385 bytes docu/nd/Data/FileInfo.nd | 6 ++++- docu/nd/Data/IndexInfo.nd | Bin 226 -> 226 bytes docu/nd/Data/SymbolTable.nd | Bin 6457 -> 6606 bytes docu/nd/files/stupid_template_engine-php.html | 4 ++- docu/nd/index/General.html | 16 ++++++------ docu/nd/javascript/searchdata.js | 20 +++++++------- docu/nd/search/GeneralL.html | 2 +- stupid_template_engine.php | 4 +++ 11 files changed, 84 insertions(+), 21 deletions(-) create mode 100644 COPYING create mode 100644 README.markdown diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..b220583 --- /dev/null +++ b/COPYING @@ -0,0 +1,17 @@ +Copyright (c) 2011 Kevin Chabowski + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS +IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR +THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.markdown b/README.markdown new file mode 100644 index 0000000..bfaa4ad --- /dev/null +++ b/README.markdown @@ -0,0 +1,36 @@ +Stupid Template Engine +====================== + +The Stupid Template Engine (STE) is a template engine for the PHP programming +language. + +Requirements +------------ + +PHP >= 5.3 + +Why should you use it? +---------------------- + +* It's syntax (inspired by Textpattern's template syntax) is very easy and + similar to the syntax of (X)HTML. So it should be easy for designers to learn + this system. +* It has a simple, yet powerful plugin interface. You can easily define your + own template functions / tags. It is even possible to write them in the + template language itself, which makes it kind of a programming language... +* It can transcompile templates into PHP. +* You can use anonymous functions to define custom tags. + +Annoying things. +---------------- + +* The error messages the parser returns, when your template has errors, are not + very helpful, i.e. the position of the error is not returned. You have to seek + it yourself. +* No caching. Could be slow on websites with many hits. + +WARNING +------- + +Early development, that means that it might be pretty buggy at the moment... + diff --git a/docu/nd/Data/ClassHierarchy.nd b/docu/nd/Data/ClassHierarchy.nd index 2e0591a..e4063da 100644 Binary files a/docu/nd/Data/ClassHierarchy.nd and b/docu/nd/Data/ClassHierarchy.nd differ diff --git a/docu/nd/Data/FileInfo.nd b/docu/nd/Data/FileInfo.nd index b0f91a4..696bf2b 100644 --- a/docu/nd/Data/FileInfo.nd +++ b/docu/nd/Data/FileInfo.nd @@ -1,3 +1,7 @@ 1.4 PHP -/home/skadu/public_html/stupid_template_engine/stupid_template_engine.php 1316548283 1 stupid_template_engine.php +/home/skadu/public_html/stupid_template_engine/stupid_template_engine.php 1316557025 1 stupid_template_engine.php +/home/skadu/public_html/stupid_template_engine/example/templates/transc/master.html.php 1316556841 0 /home/skadu/public_html/stupid_template_engine/example/templates/transc/master.html.php +/home/skadu/public_html/stupid_template_engine/example/templates/transc/articles.html.php 1316556695 0 /home/skadu/public_html/stupid_template_engine/example/templates/transc/articles.html.php +/home/skadu/public_html/stupid_template_engine/example/index.php 1316556488 0 /home/skadu/public_html/stupid_template_engine/example/index.php +/home/skadu/public_html/stupid_template_engine/example/templates/transc/custom_tags.tpl.php 1316556629 0 /home/skadu/public_html/stupid_template_engine/example/templates/transc/custom_tags.tpl.php diff --git a/docu/nd/Data/IndexInfo.nd b/docu/nd/Data/IndexInfo.nd index bd66e34..79e6270 100644 Binary files a/docu/nd/Data/IndexInfo.nd and b/docu/nd/Data/IndexInfo.nd differ diff --git a/docu/nd/Data/SymbolTable.nd b/docu/nd/Data/SymbolTable.nd index 00e4146..34da931 100644 Binary files a/docu/nd/Data/SymbolTable.nd and b/docu/nd/Data/SymbolTable.nd differ diff --git a/docu/nd/files/stupid_template_engine-php.html b/docu/nd/files/stupid_template_engine-php.html index 025f28b..efbb4b8 100644 --- a/docu/nd/files/stupid_template_engine-php.html +++ b/docu/nd/files/stupid_template_engine-php.html @@ -11,7 +11,9 @@ if (browserType) {document.write("
");if (browserV -

stupid_template_engine.php

The implementation of the Stupid Template Engine.

Summary
stupid_template_engine.phpThe implementation of the Stupid Template Engine.
steEverything in this file is in this namespace.
Functions
parseParsing a STE T/PL template.
transcompileTranscompiles an abstract syntax tree to PHP.
Constants
Template modes
StorageAccessAn interface.
Functions
loadLoading a template.
saveSaves a template.
FilesystemStorageAccessThe default StorageAccess implementation for loading / saving templates into a directory structure.
Functions
__construct
STECoreThe Core of STE
Variables
Public variables
Functions
__construct
register_tagRegister a custom tag.
call_tagCalling a custom tag (builtin ones can not be called)
exectemplateExecutes a template and returns the result.
get_var_referenceGet a reference to a template variable using a variable name.
get_var_by_nameGet a template variable by its name.
loadLoad a template and return its result (blocks not included, use exectemplate for this).
evalboolTest, if a text represents false (an empty / only whitespace text) or true (everything else).
+

stupid_template_engine.php

The implementation of the Stupid Template Engine.

Summary
stupid_template_engine.phpThe implementation of the Stupid Template Engine.
LicenseThis file is licensed under the MIT/X11 License.
steEverything in this file is in this namespace.
Functions
parseParsing a STE T/PL template.
transcompileTranscompiles an abstract syntax tree to PHP.
Constants
Template modes
StorageAccessAn interface.
Functions
loadLoading a template.
saveSaves a template.
FilesystemStorageAccessThe default StorageAccess implementation for loading / saving templates into a directory structure.
Functions
__construct
STECoreThe Core of STE
Variables
Public variables
Functions
__construct
register_tagRegister a custom tag.
call_tagCalling a custom tag (builtin ones can not be called)
exectemplateExecutes a template and returns the result.
get_var_referenceGet a reference to a template variable using a variable name.
get_var_by_nameGet a template variable by its name.
loadLoad a template and return its result (blocks not included, use exectemplate for this).
evalboolTest, if a text represents false (an empty / only whitespace text) or true (everything else).
+ +

License

This file is licensed under the MIT/X11 License.  See COPYING for more details.

ste

Everything in this file is in this namespace.

Summary
Functions
parseParsing a STE T/PL template.
transcompileTranscompiles an abstract syntax tree to PHP.
Constants
Template modes
diff --git a/docu/nd/index/General.html b/docu/nd/index/General.html index 5760937..6e92b33 100644 --- a/docu/nd/index/General.html +++ b/docu/nd/index/General.html @@ -11,7 +11,7 @@ if (browserType) {document.write("
");if (browserV -
Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
$#!
 __construct
B
$blockorder, STECore
$blocks, STECore
C
 call_tag, STECore
 Constants, ste
E
 evalbool, STECore
 exectemplate, STECore
F
 FilesystemStorageAccess
 Functions
G
 get_var_by_name, STECore
 get_var_reference, STECore
L
 load
M
 MODE_SOURCE, ste
 MODE_TRANSCOMPILED, ste
P
 parse, ste
 Public variables, STECore
R
 register_tag, STECore
S
 save, StorageAccess
 ste
 STECore
 StorageAccess
 stupid_template_engine.php
T
 Template modes, ste
 transcompile, ste
V
 Variables, STECore
$vars, STECore
+
Index
$#! · 0-9 · A · B · C · D · E · F · G · H · I · J · K · L · M · N · O · P · Q · R · S · T · U · V · W · X · Y · Z
$#!
 __construct
B
$blockorder, STECore
$blocks, STECore
C
 call_tag, STECore
 Constants, ste
E
 evalbool, STECore
 exectemplate, STECore
F
 FilesystemStorageAccess
 Functions
G
 get_var_by_name, STECore
 get_var_reference, STECore
L
 License
 load
M
 MODE_SOURCE, ste
 MODE_TRANSCOMPILED, ste
P
 parse, ste
 Public variables, STECore
R
 register_tag, STECore
S
 save, StorageAccess
 ste
 STECore
 StorageAccess
 stupid_template_engine.php
T
 Template modes, ste
 transcompile, ste
V
 Variables, STECore
$vars, STECore
public function __construct($src,
$transc)
public function __construct($storage_access)
@@ -37,31 +37,31 @@ if (browserType) {document.write("
");if (browserV -
public function load($tpl,  
$quiet = False)
Load a template and return its result (blocks not included, use exectemplate for this).
public function load($tpl,
&$mode)
Loading a template.
+
This file is licensed under the MIT/X11 License.
public function load($tpl,  
$quiet = False)
Load a template and return its result (blocks not included, use exectemplate for this).
public function load($tpl,
&$mode)
Loading a template.
-
The Templates source
The transcompiled template
+
The Templates source
The transcompiled template
-
function parse($code)
Parsing a STE T/PL template.
+
function parse($code)
Parsing a STE T/PL template.
-
public function register_tag($name,
$callback)
Register a custom tag.
+
public function register_tag($name,
$callback)
Register a custom tag.
-
public function save($tpl,
$data,
$mode)
Saves a template.
Everything in this file is in this namespace.
The Core of STE
An interface.
The implementation of the Stupid Template Engine.
+
public function save($tpl,
$data,
$mode)
Saves a template.
Everything in this file is in this namespace.
The Core of STE
An interface.
The implementation of the Stupid Template Engine.
-
function transcompile($ast) /* Transcompile and add some boilerplate code. */
Transcompiles an abstract syntax tree to PHP.
+
function transcompile($ast) /* Transcompile and add some boilerplate code. */
Transcompiles an abstract syntax tree to PHP.
-
Associative array of all template variables.
+
Associative array of all template variables.
diff --git a/docu/nd/javascript/searchdata.js b/docu/nd/javascript/searchdata.js index 985032f..3095b6a 100644 --- a/docu/nd/javascript/searchdata.js +++ b/docu/nd/javascript/searchdata.js @@ -119,7 +119,7 @@ var indexSectionsWithContent = { "Y": false, "Z": false }, - "Classes": { + "Constants": { "Symbols": false, "Numbers": false, "A": false, @@ -127,21 +127,21 @@ var indexSectionsWithContent = { "C": false, "D": false, "E": false, - "F": true, + "F": false, "G": false, "H": false, "I": false, "J": false, "K": false, "L": false, - "M": false, + "M": true, "N": false, "O": false, "P": false, "Q": false, "R": false, - "S": true, - "T": false, + "S": false, + "T": true, "U": false, "V": false, "W": false, @@ -149,7 +149,7 @@ var indexSectionsWithContent = { "Y": false, "Z": false }, - "Constants": { + "Classes": { "Symbols": false, "Numbers": false, "A": false, @@ -157,21 +157,21 @@ var indexSectionsWithContent = { "C": false, "D": false, "E": false, - "F": false, + "F": true, "G": false, "H": false, "I": false, "J": false, "K": false, "L": false, - "M": true, + "M": false, "N": false, "O": false, "P": false, "Q": false, "R": false, - "S": false, - "T": true, + "S": true, + "T": false, "U": false, "V": false, "W": false, diff --git a/docu/nd/search/GeneralL.html b/docu/nd/search/GeneralL.html index 6dd84af..6638fd5 100644 --- a/docu/nd/search/GeneralL.html +++ b/docu/nd/search/GeneralL.html @@ -11,7 +11,7 @@ if (browserType) {document.write("
");if (browserV -
Loading...
Searching...
No Matches