sync
authorAlan Knowles <alan@roojs.com>
Fri, 3 Aug 2012 05:26:46 +0000 (13:26 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 3 Aug 2012 05:26:46 +0000 (13:26 +0800)
Roo/DomTemplate.js
examples/view/domtemplate.html

index 5ce2275..fe95bea 100644 (file)
@@ -71,8 +71,8 @@ Roo.extend(Roo.DomTemplate, Roo.Template, {
      *  x.t:(test,tesT) 
      * 
      */
-    re : /\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
-
+    re : /(\{|%7B])([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?(\}|%7D)/g,
+    //re : /\{([\w-\.]+)(?:\:([\w\.]*)(?:\((.*?)?\))?)?\}/g,
     
     iterChild : function (node, method) {
         
@@ -207,6 +207,11 @@ Roo.extend(Roo.DomTemplate, Roo.Template, {
         var div = document.createElement('div');
         div.appendChild(node);
         tpl.dom = node;
+        // this has the unfortunate side effect of converting tagged attributes
+        // eg. href="{...}" into %7C...%7D
+        // this has been fixed by searching for those combo's although it's a bit hacky..
+        
+        
         tpl.body = div.innerHTML;
         
         
@@ -241,8 +246,14 @@ Roo.extend(Roo.DomTemplate, Roo.Template, {
         
         
     },
+    
+    
+    
+    
     /**
      * Compile a segment of the template into a 'sub-template'
+     *
+     * 
      * 
      *
      */
@@ -250,19 +261,24 @@ Roo.extend(Roo.DomTemplate, Roo.Template, {
     {
         var fm = Roo.util.Format;
         var useF = this.disableFormats !== true;
+        
         var sep = Roo.isGecko ? "+\n" : ",\n";
+        
         var undef = function(str) {
             Roo.log("Property not found :"  + str);
             return '';
         };
+         
+        
         
-        var fn = function(m, name, format, args)
+        var fn = function(m, lbrace, name, format, args)
         {
+            //Roo.log("ARGS");
             //Roo.log(arguments);
             args = args ? args.replace(/\\'/g,"'") : args;
             //["{TEST:(a,b,c)}", "TEST", "", "a,b,c", 0, "{TEST:(a,b,c)}"]
             if (typeof(format) == 'undefined') {
-                format= 'htmlEncode';
+                format =  'htmlEncode'; 
             }
             if (format == 'raw' ) {
                 format = false;
index 377d561..0465a00 100644 (file)
@@ -14,7 +14,7 @@ Roo.onReady(function() {
     
     var html = Roo.get('body').dom.innerHTML;
     Roo.get('body').dom.innerHTML = '';
-    
+    Roo.debug = 1;
     
     // nice and global to test with..
     tpl = new Roo.DomTemplate({
@@ -60,7 +60,7 @@ Roo.onReady(function() {
             <li roo-if="ontable == 'mtrack_ticket'"  class="change-log-item">
                 <div class="timelineevent">  
                     <div class="timelinetext">
-                        <div class="timelinereason">
+                        <div class="timelinereason" name="{changedate}">
                             <span class="time">{changedate.format:('H:i:s')}</span>