projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
71a4524
)
JsTemplate.php
author
Alan Knowles
<alan@akbkhome.com>
Thu, 17 Nov 2011 09:35:42 +0000
(17:35 +0800)
committer
Alan Knowles
<alan@akbkhome.com>
Thu, 17 Nov 2011 09:35:42 +0000
(17:35 +0800)
JsTemplate.php
patch
|
blob
|
history
diff --git
a/JsTemplate.php
b/JsTemplate.php
index
9f284ce
..
33a8c6e
100644
(file)
--- a/
JsTemplate.php
+++ b/
JsTemplate.php
@@
-97,14
+97,16
@@
class Pman_Core_JsTemplate extends Pman {
$ar = preg_split('/(\{[^\}]+})/', $contents, -1, PREG_SPLIT_DELIM_CAPTURE);
//echo '<PRE>' . htmlspecialchars(print_r($ar,true));
$ar = preg_split('/(\{[^\}]+})/', $contents, -1, PREG_SPLIT_DELIM_CAPTURE);
//echo '<PRE>' . htmlspecialchars(print_r($ar,true));
- $
ret
= array();
+ $
out
= array();
- $
re
t[] = "var $name = function(t) {\n var ret=[];\n";
+ $
ou
t[] = "var $name = function(t) {\n var ret=[];\n";
$funcs = array();
// do not allow nested functions..?
$fstart = 0;
$indent = 1;
$funcs = array();
// do not allow nested functions..?
$fstart = 0;
$indent = 1;
+
+ $ret = &$out;
foreach($ar as $item) {
$in = str_repeat(" ", $indent);
foreach($ar as $item) {
$in = str_repeat(" ", $indent);
@@
-138,7
+140,7
@@
class Pman_Core_JsTemplate extends Pman {
case (substr($item,1,9) == 'function:'):
$fstart = $indent;
$indent++;
case (substr($item,1,9) == 'function:'):
$fstart = $indent;
$indent++;
-
+ $ret = &$funct;
$def = substr($item,10,-1) ;
list($name,$body) = explode('(', $def, 2);
$def = substr($item,10,-1) ;
list($name,$body) = explode('(', $def, 2);