remove debugging code
[roojs1] / Roo / doc / Example.js
index 3bcff16..5ae32f0 100644 (file)
@@ -8,9 +8,10 @@
  * @extends Roo.bootstrap.Component
  * Example Element class
  * @cfg {String} title short title describing example
- * @cfg {String} lang (php|txt|sql) section type.
+ * @cfg {String} lang (php|txt|sql) code language.
  * @cfg {String} code  example code
  * @cfg {String} output The expected output from the code
+ * @cfg {String} outputlang php|txt|sql) output language
  *
  * 
  * @constructor
@@ -28,11 +29,16 @@ Roo.extend(Roo.doc.Example, Roo.bootstrap.Component,  {
     lang:   'php',
     code : '',
     output : '',
+    outputlang : 'txt',
     
     getAutoCreate : function(){
         
         // no colour highlighting in here....
         
+        var code = hljs ? hljs.highlight(this.lang,this.code).value :
+                String.format('{0}',this.code).replace(/\n/g, '<br/>');
+        
+        Roo.log("code=" + code);
         var cfg ={
             cls : 'panel panel-info',
             cn : [
@@ -46,7 +52,7 @@ Roo.extend(Roo.doc.Example, Roo.bootstrap.Component,  {
                         {
                             tag: 'pre',
                             cls : 'lang-' + this.lang,
-                            html :  String.format('{0}',this.code).replace(/\n/g, '<br/>')
+                            html :  code
                         }
                     ]
                 }
@@ -54,18 +60,21 @@ Roo.extend(Roo.doc.Example, Roo.bootstrap.Component,  {
         };
         
         if (this.output) {
+            
+            var out = hljs ? hljs.highlight(this.outputlang,this.output).value :
+                    String.format('{0}',this.output).replace(/\n/g, '<br/>');
             cfg.cn.push(
 
                 {
                     cls : 'panel-footer',
                     cn : {
-                        tag: 'code',
-                        html :  String.format('{0}',this.output).replace(/\n/g, '<br/>')
+                        tag: 'pre',
+                        html : out 
                     }
                 }
             
                 
-            );
+            );      
         }