summaryrefslogtreecommitdiff
path: root/example/templates/transc/master.html.php
diff options
context:
space:
mode:
authorKevin Chabowski <kevin@kch42.de>2013-10-25 21:44:02 +0200
committerKevin Chabowski <kevin@kch42.de>2013-10-25 21:44:02 +0200
commitdd03af69265ad686ae8daff6ecbd9df763e6d19f (patch)
treea86dae876afae2dcea9a3d70e3b513e305b38415 /example/templates/transc/master.html.php
parent91b965181f907b169aeeff63a6c15f9b8df9d9a9 (diff)
parenteebf5cb885f266104333ac145355ef6e2599e5f6 (diff)
downloadste-dd03af69265ad686ae8daff6ecbd9df763e6d19f.tar.gz
ste-dd03af69265ad686ae8daff6ecbd9df763e6d19f.tar.bz2
ste-dd03af69265ad686ae8daff6ecbd9df763e6d19f.zip
Merge branch 'parser2'
STE gets a new, more robust parser. The previous parser was very fragile and relied on some ugly regular expressions. Other advantages of the new parser: * No precompile phase to implement short tags (?{}, ~{}), that means short tags can now be nested in any order. * The parses now uses the mb_* functions, so it should handle non-ascii text correctly. There were also some improvements to the compiler: * Various small bugfixes. * The compiler accepts and compiles tag parameters that have tags in them. The parser still doesn't accept this (and probably never will), this is mainly used to allow arbitrary code inside of short cmp tags (~{..}). There are now (finally!) tests for the language to maintain a certain quality and consistency (which STE lacked in the past, to be honest). And finally the code was reformatted. Now 1TBS is used instead of Allman.
Diffstat (limited to 'example/templates/transc/master.html.php')
-rw-r--r--example/templates/transc/master.html.php503
1 files changed, 0 insertions, 503 deletions
diff --git a/example/templates/transc/master.html.php b/example/templates/transc/master.html.php
deleted file mode 100644
index 1bee843..0000000
--- a/example/templates/transc/master.html.php
+++ /dev/null
@@ -1,503 +0,0 @@
-<?php $transcompile_fx = function($ste)
-{/*Array
-(
- [0] => ste\TextNode Object
- (
- [text] => <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en">
-<head>
- <title>
- [tpl] => master.html
- [offset] => 0
- )
-
- [1] => ste\TagNode Object
- (
- [name] => if
- [params] => Array
- (
- )
-
- [sub] => Array
- (
- [0] => ste\VariableNode Object
- (
- [name] => title
- [arrayfields] => Array
- (
- )
-
- [tpl] => master.html
- [offset] => 206
- )
-
- [1] => ste\TagNode Object
- (
- [name] => then
- [params] => Array
- (
- )
-
- [sub] => Array
- (
- [0] => ste\VariableNode Object
- (
- [name] => title
- [arrayfields] => Array
- (
- )
-
- [tpl] => master.html
- [offset] => 222
- )
-
- [1] => ste\TextNode Object
- (
- [text] => - example
- [tpl] => master.html
- [offset] => 227
- )
-
- )
-
- [tpl] => master.html
- [offset] => 211
- )
-
- [2] => ste\TagNode Object
- (
- [name] => else
- [params] => Array
- (
- )
-
- [sub] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => example
- [tpl] => master.html
- [offset] => 258
- )
-
- )
-
- [tpl] => master.html
- [offset] => 248
- )
-
- )
-
- [tpl] => master.html
- [offset] => 197
- )
-
- [2] => ste\TextNode Object
- (
- [text] => </title>
- [tpl] => master.html
- [offset] => 285
- )
-
- [3] => ste\TextNode Object
- (
- [text] => <style type="text/css">
- * {
- font-family: sans-serif;
- }
- .online {
- color: #0a0;
- }
- .offline {
- color: #555;
- font-style: italic;
-
- }
- </style>
-
-</head>
-<body>
- <h1>example</h1>
-
- <div id="content">
-
- [tpl] => master.html
- [offset] => 384
- )
-
- [4] => ste\TagNode Object
- (
- [name] => block
- [params] => Array
- (
- [name] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => content
- [tpl] => master.html
- [offset] => 626
- )
-
- )
-
- )
-
- [sub] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => Default content.
-
- [tpl] => master.html
- [offset] => 635
- )
-
- )
-
- [tpl] => master.html
- [offset] => 609
- )
-
- [5] => ste\TextNode Object
- (
- [text] => </div>
- <div id="otherstuff">
-
- [tpl] => master.html
- [offset] => 670
- )
-
- [6] => ste\TagNode Object
- (
- [name] => block
- [params] => Array
- (
- [name] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => otherstuff
- [tpl] => master.html
- [offset] => 721
- )
-
- )
-
- )
-
- [sub] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => <h2>List of users</h2>
-
- [tpl] => master.html
- [offset] => 733
- )
-
- [1] => ste\TextNode Object
- (
- [text] => <ul>
-
- [tpl] => master.html
- [offset] => 820
- )
-
- [2] => ste\TagNode Object
- (
- [name] => foreach
- [params] => Array
- (
- [array] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => users
- [tpl] => master.html
- [offset] => 853
- )
-
- )
-
- [value] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => user
- [tpl] => master.html
- [offset] => 867
- )
-
- )
-
- )
-
- [sub] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => <li class="
- [tpl] => master.html
- [offset] => 873
- )
-
- [1] => ste\TagNode Object
- (
- [name] => if
- [params] => Array
- (
- )
-
- [sub] => Array
- (
- [0] => ste\VariableNode Object
- (
- [name] => user
- [arrayfields] => Array
- (
- [0] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => online
- [tpl] => master.html
- [offset] => 904
- )
-
- )
-
- )
-
- [tpl] => master.html
- [offset] => 899
- )
-
- [1] => ste\TagNode Object
- (
- [name] => then
- [params] => Array
- (
- )
-
- [sub] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => online
- [tpl] => master.html
- [offset] => 921
- )
-
- )
-
- [tpl] => master.html
- [offset] => 911
- )
-
- [2] => ste\TagNode Object
- (
- [name] => else
- [params] => Array
- (
- )
-
- [sub] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => offline
- [tpl] => master.html
- [offset] => 948
- )
-
- )
-
- [tpl] => master.html
- [offset] => 938
- )
-
- )
-
- [tpl] => master.html
- [offset] => 890
- )
-
- [2] => ste\TextNode Object
- (
- [text] => ">
- [tpl] => master.html
- [offset] => 975
- )
-
- [3] => ste\VariableNode Object
- (
- [name] => user
- [arrayfields] => Array
- (
- [0] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => name
- [tpl] => master.html
- [offset] => 983
- )
-
- )
-
- )
-
- [tpl] => master.html
- [offset] => 978
- )
-
- [4] => ste\TextNode Object
- (
- [text] => (
- [tpl] => master.html
- [offset] => 988
- )
-
- [5] => ste\VariableNode Object
- (
- [name] => user
- [arrayfields] => Array
- (
- [0] => Array
- (
- [0] => ste\TextNode Object
- (
- [text] => username
- [tpl] => master.html
- [offset] => 996
- )
-
- )
-
- )
-
- [tpl] => master.html
- [offset] => 991
- )
-
- [6] => ste\TextNode Object
- (
- [text] => )</li>
-
- [tpl] => master.html
- [offset] => 1005
- )
-
- )
-
- [tpl] => master.html
- [offset] => 833
- )
-
- [3] => ste\TextNode Object
- (
- [text] => </ul>
-
- [tpl] => master.html
- [offset] => 1030
- )
-
- )
-
- [tpl] => master.html
- [offset] => 704
- )
-
- [7] => ste\TextNode Object
- (
- [text] => </div>
-</body>
-</html>
-
- [tpl] => master.html
- [offset] => 1054
- )
-
-)
-*/
- $outputstack = array('');
- $outputstack_i = 0;
- $outputstack[$outputstack_i] .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\t\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-us\" lang=\"en\">\n<head>\n\t<title>";
- $outputstack[] = "";
- $outputstack_i++;
- $outputstack[$outputstack_i] .= @$ste->vars["title"];
- $outputstack_i--;
- if($ste->evalbool(array_pop($outputstack)))
- {
- $outputstack[$outputstack_i] .= @$ste->vars["title"] . " - example";
-
- }
- else
- {
- $outputstack[$outputstack_i] .= "example";
-
- }
- $outputstack[$outputstack_i] .= "</title>" . "<style type=\"text/css\">\n\t\t* {\n\t\t\tfont-family: sans-serif;\n\t\t}\n\t\t.online {\n\t\t\tcolor: #0a0;\n\t\t}\n\t\t.offline {\n\t\t\tcolor: #555;\n\t\t\tfont-style: italic;\n\t\t\t\n\t\t}\n\t</style>\n\t\n</head>\n<body>\n\t<h1>example</h1>\n\t\n\t<div id=\"content\">\n\t\t";
- $blockname_4f4e94ddd41342_39491438 = "content";
- $ste->blocks['4f4e94ddd41470.10353359'] = array_pop($outputstack);
- $ste->blockorder[] = '4f4e94ddd41470.10353359';
- $outputstack = array('');
- $outputstack_i = 0;
- $outputstack[$outputstack_i] .= "Default content.\n\t\t";
- $ste->blocks[$blockname_4f4e94ddd41342_39491438] = array_pop($outputstack);
- if(array_search($blockname_4f4e94ddd41342_39491438, $ste->blockorder) === FALSE)
- $ste->blockorder[] = $blockname_4f4e94ddd41342_39491438;
- $outputstack = array('');
- $outputstack_i = 0;
- $outputstack[$outputstack_i] .= "</div>\n\t<div id=\"otherstuff\">\n\t\t";
- $blockname_4f4e94ddd415e6_09352068 = "otherstuff";
- $ste->blocks['4f4e94ddd416b2.98760934'] = array_pop($outputstack);
- $ste->blockorder[] = '4f4e94ddd416b2.98760934';
- $outputstack = array('');
- $outputstack_i = 0;
- $outputstack[$outputstack_i] .= "<h2>List of users</h2>\n\t\t\t" . "<ul>\n\t\t\t\t";
- $foreachloop_4f4e94ddd417b7_50245786_arrayvar = "users";
- $foreachloop_4f4e94ddd417b7_50245786_valuevar = "user";
- $foreachloop_4f4e94ddd417b7_50245786_array = $ste->get_var_by_name($foreachloop_4f4e94ddd417b7_50245786_arrayvar);
- if(!is_array($foreachloop_4f4e94ddd417b7_50245786_array))
- $foreachloop_4f4e94ddd417b7_50245786_array = array();
- foreach($foreachloop_4f4e94ddd417b7_50245786_array as $foreachloop_4f4e94ddd417b7_50245786_key => $foreachloop_4f4e94ddd417b7_50245786_value)
- {
- try
- {
- $ste->set_var_by_name($foreachloop_4f4e94ddd417b7_50245786_valuevar, $foreachloop_4f4e94ddd417b7_50245786_value);
-
- $outputstack[$outputstack_i] .= "<li class=\"";
- $outputstack[] = "";
- $outputstack_i++;
- $outputstack[$outputstack_i] .= @$ste->vars["user"]["online"];
- $outputstack_i--;
- if($ste->evalbool(array_pop($outputstack)))
- {
- $outputstack[$outputstack_i] .= "online";
-
- }
- else
- {
- $outputstack[$outputstack_i] .= "offline";
-
- }
- $outputstack[$outputstack_i] .= "\">" . @$ste->vars["user"]["name"] . " (" . @$ste->vars["user"]["username"] . ")</li>\n\t\t\t\t";
-
- }
- catch(\ste\BreakException $e) { break; }
- catch(\ste\ContinueException $e) { continue; }
-
- }
-
- $outputstack[$outputstack_i] .= "</ul>\n\t\t";
- $ste->blocks[$blockname_4f4e94ddd415e6_09352068] = array_pop($outputstack);
- if(array_search($blockname_4f4e94ddd415e6_09352068, $ste->blockorder) === FALSE)
- $ste->blockorder[] = $blockname_4f4e94ddd415e6_09352068;
- $outputstack = array('');
- $outputstack_i = 0;
- $outputstack[$outputstack_i] .= "</div>\n</body>\n</html>\n";
- return array_pop($outputstack);
-}; ?> \ No newline at end of file