projects
/
Pman.Core
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
fe508f7
)
JsTemplate.php
author
Alan Knowles
<alan@akbkhome.com>
Thu, 17 Nov 2011 09:44:33 +0000
(17:44 +0800)
committer
Alan Knowles
<alan@akbkhome.com>
Thu, 17 Nov 2011 09:44:33 +0000
(17:44 +0800)
JsTemplate.php
patch
|
blob
|
history
diff --git
a/JsTemplate.php
b/JsTemplate.php
index
3a86a02
..
b19c87f
100644
(file)
--- a/
JsTemplate.php
+++ b/
JsTemplate.php
@@
-95,6
+95,10
@@
class Pman_Core_JsTemplate extends Pman {
$contents = file_get_contents($fn);
$ar = preg_split('/(\{[^\}]+})/', $contents, -1, PREG_SPLIT_DELIM_CAPTURE);
$contents = file_get_contents($fn);
$ar = preg_split('/(\{[^\}]+})/', $contents, -1, PREG_SPLIT_DELIM_CAPTURE);
+
+
+
+
//echo '<PRE>' . htmlspecialchars(print_r($ar,true));
$out= array();
//echo '<PRE>' . htmlspecialchars(print_r($ar,true));
$out= array();
@@
-115,6
+119,10
@@
class Pman_Core_JsTemplate extends Pman {
case (!strlen($item)):
continue;
case (!strlen($item)):
continue;
+ if ($inscript && ($item != '{end:}') {
+ $ret[] = $item;
+ }
+
case ($item[0] != '{'):
if (!strlen(trim($item))) {
continue;
case ($item[0] != '{'):
if (!strlen(trim($item))) {
continue;
@@
-122,6
+130,13
@@
class Pman_Core_JsTemplate extends Pman {
$ret[] = $in . "ret += ". json_encode($item) . ";";
continue;
$ret[] = $in . "ret += ". json_encode($item) . ";";
continue;
+
+ case (substr($item,1,6) == 'script:'):
+ $inscript = true;
+ continue;
+
+
+
case (substr($item,1,3) == 'if('):
$ret[] = $in . substr($item,1,-1) . ' {';
$indent++;
case (substr($item,1,3) == 'if('):
$ret[] = $in . substr($item,1,-1) . ' {';
$indent++;