Roo/doc/Entry.js
authorAlan Knowles <alan@roojs.com>
Thu, 13 Oct 2016 07:58:47 +0000 (15:58 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 13 Oct 2016 07:58:47 +0000 (15:58 +0800)
roojs-doc.js
roojs-doc-debug.js

Roo/doc/Entry.js
roojs-doc-debug.js
roojs-doc.js

index 6ecd411..da7a78c 100644 (file)
@@ -22,6 +22,7 @@ Roo.doc = Roo.doc || {};
 Roo.doc.Entry  = function(config){
     Roo.doc.Entry.superclass.constructor.call(this, config);
     //this.el = Roo.get(document.body);
+    /*
     var body = Roo.get(document.body);
     body.attr({
         leftmargin : 0,
@@ -36,10 +37,11 @@ Roo.doc.Entry  = function(config){
     this.onRender(body);
     this.el = body;
     //this.onRender = function() { };
+    */
 
 };
 
-Roo.doc.Entry._calls = 0;
+//Roo.doc.Entry._calls = 0;
 
 Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component,  {
     
@@ -64,17 +66,15 @@ Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component,  {
             ]
         };
         
-        
          
-       
         return cfg;
     },
     
     addxtype :   function (tree, cntr)
     {
         return this.addxtypeChild(tree,cntr);
-    },
-    
+    }
+    /*
     onRender : function(ct, position)
     {
         
@@ -87,6 +87,7 @@ Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component,  {
     
         Roo.bootstrap.Component.prototype.onRender.call(this, ct, position);
     }
+    */
    
 });
 
index 4dadd85..cef952b 100644 (file)
@@ -22,6 +22,7 @@ Roo.doc = Roo.doc || {};
 Roo.doc.Entry  = function(config){
     Roo.doc.Entry.superclass.constructor.call(this, config);
     //this.el = Roo.get(document.body);
+    /*
     var body = Roo.get(document.body);
     body.attr({
         leftmargin : 0,
@@ -36,10 +37,11 @@ Roo.doc.Entry  = function(config){
     this.onRender(body);
     this.el = body;
     //this.onRender = function() { };
+    */
 
 };
 
-Roo.doc.Entry._calls = 0;
+//Roo.doc.Entry._calls = 0;
 
 Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component,  {
     
@@ -64,17 +66,15 @@ Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component,  {
             ]
         };
         
-        
          
-       
         return cfg;
     },
     
     addxtype :   function (tree, cntr)
     {
         return this.addxtypeChild(tree,cntr);
-    },
-    
+    }
+    /*
     onRender : function(ct, position)
     {
         
@@ -87,6 +87,7 @@ Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component,  {
     
         Roo.bootstrap.Component.prototype.onRender.call(this, ct, position);
     }
+    */
    
 });
 
@@ -122,12 +123,14 @@ 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.toUpperCase(),this.code) : String.format('{0}',this.code).replace(/\n/g, '<br/>');
+        var code = hljs ? hljs.highlight(this.lang,this.code).value :
+                String.format('{0}',this.code).replace(/\n/g, '<br/>');
         
         
         var cfg ={
@@ -151,18 +154,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 
                     }
                 }
             
                 
-            );
+            );      
         }
         
         
@@ -391,7 +397,7 @@ Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
     getAutoCreate : function(){
         
         
-        
+        var syn = Roo.factory(this.parent().items[0]);
         
         var cfg ={
             
@@ -415,7 +421,7 @@ Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
                 cn : []
             };
             // might not have any..
-            var params = this.parent().items[0].items;
+            var params = syn.items;
             for (var i =0; i < params.length;i++) {
                 ul.cn.push( Roo.factory(params[i]).getAutoCreateParamSection() )
             }
@@ -423,7 +429,23 @@ Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
             
             cfg.cn.push(ul);
         }
-        
+        if (this.stype == 'return' && syn.returndesc.length) {
+            
+            cfg.cn.push({
+                tag: 'p',
+                cls : 'para',
+                cn : [
+                
+                    {
+                        tag: 'code',
+                        cls: 'parameter',
+                        html : syn.returntype
+                    },
+                    syn.returndesc
+                ]
+                
+            });
+        }
        
         return cfg;
     },
@@ -433,6 +455,7 @@ Roo.extend(Roo.doc.Section, Roo.bootstrap.Component,  {
         if (this.stype == 'parameter') {
             return this.el.select('.roo-params',true).first();
         }
+       
         return this.el;
     }
     
@@ -458,6 +481,7 @@ Roo.doc.Section.map = {
  * @extends Roo.bootstrap.Component
  * Synopsis Element class
  * @cfg {String} returntype return value
+ * @cfg {String} returndesc description of return value. (used in the return section if set..)
  * @cfg {String} name title really..
  * @cfg {String} stype (function|constant)
  * @cfg {String} memberof class name
@@ -477,13 +501,22 @@ Roo.extend(Roo.doc.Synopsis, Roo.bootstrap.Component,  {
     memberof : '',
     is_static : false,
     returntype : '',
+    returndesc : '',
     name: '',
     stype:   'function',
      
     getAutoCreate : function(){
         
         var syn = this.items[0]; // hopefully...
-        Roo.log(this.items);
+        
+        
+        
+        var nmp = (this.is_static ? '' : '$') +
+            this.memberof +
+            (this.is_static ? '::' : '->');
+            
+         
+        // this should probably do the params....?? then we need to disable the rendering..
         
          
         var cfg ={
@@ -499,7 +532,7 @@ Roo.extend(Roo.doc.Synopsis, Roo.bootstrap.Component,  {
                                 tag:'code',
                                 cls : 'funcprototype',
                                 cn: [
-                                    this.returntype + ' ',
+                                    this.returntype + ' ' + nmp,
                                     {
                                         tag: 'strong',
                                         cls : this.stype,
index 6dbcbcd..9d2efb5 100644 (file)
@@ -1,11 +1,10 @@
 // Roo/doc/Entry.js
-Roo.doc=Roo.doc||{};Roo.doc.Entry=function(A){Roo.doc.Entry.superclass.constructor.call(this,A);var B=Roo.get(document.body);B.attr({leftmargin:0,marginwidth:0,topmargin:0,marginheight:0,offset:0});this.onRender(B);this.el=B;};Roo.doc.Entry._calls=0;Roo.extend(Roo.doc.Entry,Roo.bootstrap.Component,{name:'',purpose:'',getAutoCreate:function(){var A={cls:'refentry',cn:[{tag:'h1',cls:'refname',html:this.name}
-,{cls:'refnamediv',html:this.purpose}]};return A;},addxtype:function(A,B){return this.addxtypeChild(A,B);},onRender:function(ct,A){Roo.doc.Entry._calls++;if(Roo.doc.Entry._calls>1||!ct){return;}Roo.bootstrap.Component.prototype.onRender.call(this,ct,A);}}
-);
+Roo.doc=Roo.doc||{};Roo.doc.Entry=function(A){Roo.doc.Entry.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Entry,Roo.bootstrap.Component,{name:'',purpose:'',getAutoCreate:function(){var A={cls:'refentry',cn:[{tag:'h1',cls:'refname',html:this.name}
+,{cls:'refnamediv',html:this.purpose}]};return A;},addxtype:function(A,B){return this.addxtypeChild(A,B);}});
 // Roo/doc/Example.js
-Roo.doc.Example=function(A){Roo.doc.Example.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Example,Roo.bootstrap.Component,{title:'',lang:'php',code:'',output:'',getAutoCreate:function(){var A=hljs?hljs.highlight(this.lang.toUpperCase(),this.code):String.format('{0}',this.code).replace(/\n/g,'<br/>');
-var B={cls:'panel panel-info',cn:[{cls:'panel-heading',html:this.title},{cls:'panel-body',cn:[{tag:'pre',cls:'lang-'+this.lang,html:A}]}]};if(this.output){B.cn.push({cls:'panel-footer',cn:{tag:'code',html:String.format('{0}',this.output).replace(/\n/g,'<br/>')}
-});}return B;}});
+Roo.doc.Example=function(A){Roo.doc.Example.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Example,Roo.bootstrap.Component,{title:'',lang:'php',code:'',output:'',outputlang:'txt',getAutoCreate:function(){var A=hljs?hljs.highlight(this.lang,this.code).value:String.format('{0}',this.code).replace(/\n/g,'<br/>');
+var B={cls:'panel panel-info',cn:[{cls:'panel-heading',html:this.title},{cls:'panel-body',cn:[{tag:'pre',cls:'lang-'+this.lang,html:A}]}]};if(this.output){var C=hljs?hljs.highlight(this.outputlang,this.output).value:String.format('{0}',this.output).replace(/\n/g,'<br/>');
+B.cn.push({cls:'panel-footer',cn:{tag:'pre',html:C}});}return B;}});
 // Roo/doc/Para.js
 Roo.doc.Para=function(A){Roo.doc.Para.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Para,Roo.bootstrap.Component,{html:'',getAutoCreate:function(){var A={tag:'p',cls:'para',html:this.html};if(this.parent().is_list){return {tag:'li',cls:listitme,cn:[A]}
 ;}return A;}});
@@ -14,10 +13,11 @@ Roo.doc.Param=function(A){Roo.doc.Param.superclass.constructor.call(this,A);};Ro
 ,this.desc]}]};}if(this.parent().stype=='return'){return {tag:'p',cls:'para',cn:[{tag:'code',html:this.type},this.desc]};}var A={tag:'span',cn:[this.is_optional?'[':'',this.type,' ',{tag:'b',html:this.name},this.defaultvalue==''?'':' = ',this.defaultvalue,this.is_optional?']':'',',']}
 ;return A;},getAutoCreateParamSection:function(){return {tag:'li',cn:[{tag:'p',cls:'para',cn:[{tag:'code',html:this.type+' '+this.name},this.desc]}]};}});
 // Roo/doc/Section.js
-Roo.doc.Section=function(A){Roo.doc.Section.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Section,Roo.bootstrap.Component,{stype:'',getAutoCreate:function(){var A={cls:'refsection',cn:[{tag:'h3',cls:'title',html:Roo.doc.Section.map[this.stype]}]}
-;if(this.stype=='parameter'){var ul={tag:'ul',cls:'itemizedlist roo-params',cn:[]};var B=this.parent().items[0].items;for(var i=0;i<B.length;i++){ul.cn.push(Roo.factory(B[i]).getAutoCreateParamSection())}A.cn.push(ul);}return A;},getChildContainer:function(A){if(this.stype=='parameter'){return this.el.select('.roo-params',true).first();
-}return this.el;}});Roo.doc.Section.map={'desc':'Description','parameter':'Parameters','return':'Return Value','note':'Notes','example':'Examples'};
+Roo.doc.Section=function(A){Roo.doc.Section.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Section,Roo.bootstrap.Component,{stype:'',getAutoCreate:function(){var A=Roo.factory(this.parent().items[0]);var B={cls:'refsection',cn:[{tag:'h3',cls:'title',html:Roo.doc.Section.map[this.stype]}
+]};if(this.stype=='parameter'){var ul={tag:'ul',cls:'itemizedlist roo-params',cn:[]};var C=A.items;for(var i=0;i<C.length;i++){ul.cn.push(Roo.factory(C[i]).getAutoCreateParamSection())}B.cn.push(ul);}if(this.stype=='return'&&A.returndesc.length){B.cn.push({tag:'p',cls:'para',cn:[{tag:'code',cls:'parameter',html:A.returntype}
+,A.returndesc]});}return B;},getChildContainer:function(A){if(this.stype=='parameter'){return this.el.select('.roo-params',true).first();}return this.el;}});Roo.doc.Section.map={'desc':'Description','parameter':'Parameters','return':'Return Value','note':'Notes','example':'Examples'};
+
 // Roo/doc/Synopsis.js
-Roo.doc.Synopsis=function(A){Roo.doc.Synopsis.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Synopsis,Roo.bootstrap.Component,{memberof:'',is_static:false,returntype:'',name:'',stype:'function',getAutoCreate:function(){var A=this.items[0];Roo.log(this.items);
-var B={tag:'h5',cls:'refsynopsisdiv',cn:[{cls:'funcsynopsis',cn:[{tag:'p',cn:{tag:'code',cls:'funcprototype',cn:[this.returntype+' ',{tag:'strong',cls:this.stype,html:this.name},'(',{tag:'span',cls:'roo-params'},')']}}]}]};return B;},getChildContainer:function(A){return this.el.select('.roo-params',true).first();
-}});
+Roo.doc.Synopsis=function(A){Roo.doc.Synopsis.superclass.constructor.call(this,A);};Roo.extend(Roo.doc.Synopsis,Roo.bootstrap.Component,{memberof:'',is_static:false,returntype:'',returndesc:'',name:'',stype:'function',getAutoCreate:function(){var A=this.items[0];
+var B=(this.is_static?'':'$')+this.memberof+(this.is_static?'::':'->');var C={tag:'h5',cls:'refsynopsisdiv',cn:[{cls:'funcsynopsis',cn:[{tag:'p',cn:{tag:'code',cls:'funcprototype',cn:[this.returntype+' '+B,{tag:'strong',cls:this.stype,html:this.name},'(',{tag:'span',cls:'roo-params'}
+,')']}}]}]};return C;},getChildContainer:function(A){return this.el.select('.roo-params',true).first();}});