Roo/doc/Synopsis.js
authorAlan Knowles <alan@roojs.com>
Thu, 8 Sep 2016 09:32:00 +0000 (17:32 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 8 Sep 2016 09:32:00 +0000 (17:32 +0800)
roojs-doc.js
roojs-doc-debug.js

Roo/doc/Synopsis.js [new file with mode: 0644]
roojs-doc-debug.js
roojs-doc.js

diff --git a/Roo/doc/Synopsis.js b/Roo/doc/Synopsis.js
new file mode 100644 (file)
index 0000000..f51cff0
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * - LGPL
+ *
+ */
+
+/**
+ * @class Roo.doc.Synopsis
+ * @extends Roo.bootstrap.Component
+ * Synopsis Element class
+ * @cfg {String} returntype return value
+ * @cfg {String} name title really..
+ * @cfg {String} stype (function|constant)
+ * 
+ * @constructor
+ * Create a new Synopsis
+ * @param {Object} config The config object
+ */
+
+Roo.mailer.Synopsis = function(config){
+    Roo.mailer.Synopsis.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.mailer.Synopsis, Roo.bootstrap.Component,  {
+    
+    
+    returntype : '',
+    name: '',
+    stype:   'function',
+     
+    getAutoCreate : function(){
+        
+        var cfg ={
+            tag: 'h2',
+            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 cfg;
+    },
+    getChildContainer : function(build_call)
+    {
+         
+        
+        return this.el.select('.roo-params',true).first();
+    }
+    
+    
+    
+    
+   
+});
+
+
\ No newline at end of file
index e69de29..e99f4da 100644 (file)
@@ -0,0 +1,453 @@
+/*
+ * - LGPL
+ *
+ *  Documentation - designed to generate HTML+Docbook!?!
+                              
+ */
+Roo.doc = Roo.doc || {};
+
+/**
+ * @class Roo.doc.Entry
+ * @extends Roo.bootstrap.Component
+ * Entry Element class - describes a method etc...
+ * @name {String} name of method
+ * @purpose {String} short description of method.
+ * 
+ * @constructor
+ * Create a new E
+ * @param {Object} config The config object
+ */
+
+
+
+Roo.mailer.Body  = function(config){
+    Roo.mailer.Body.superclass.constructor.call(this, config);
+    //this.el = Roo.get(document.body);
+    var body = Roo.get(document.body);
+    body.attr({
+        leftmargin : 0,
+        marginwidth : 0,
+        topmargin : 0,
+        marginheight : 0,
+        offset : 0
+    });
+    Roo.mailer.Body._calls++;
+    if (Roo.mailer.Body._calls > 1) {
+        throw "test";
+    }
+    // call onRender once... and block next call...?
+    this.onRender(body);
+    this.onRender = function() { };
+
+};
+
+Roo.mailer.Body._calls = 0;
+
+Roo.extend(Roo.mailer.Body, Roo.bootstrap.Component,  {
+    
+    
+    name : '',
+    purpose : '',
+    
+    getAutoCreate : function(){
+        
+        var cfg ={
+            cls : 'refentry',
+            cn : [
+                {
+                    tag: 'h1',
+                    cls: 'refname',
+                    html : this.name
+                },
+                {
+                    cls: 'refnamediv',
+                    html : this.purpose
+                }
+            ]
+        };
+        
+        
+         
+       
+        return cfg;
+    },
+    
+    addxtype :   function (tree, cntr)
+    {
+        return this.addxtypeChild(tree,cntr);
+    }
+
+    
+    
+   
+});
+
+
+ /*
+ * - LGPL
+ *
+ */
+
+/**
+ * @class Roo.doc.Example
+ * @extends Roo.bootstrap.Example
+ * Example Element class
+ * @cfg {String} lang (phpcode|programlisting) section type.
+ * @cfg {String} code
+ *
+ * 
+ * @constructor
+ * Create a new Synopsis
+ * @param {Object} config The config object
+ */
+
+Roo.mailer.Example = function(config){
+    Roo.mailer.Example.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.mailer.Example, Roo.bootstrap.Component,  {
+    
+    
+    lang:   'php',
+    code : '',
+    
+    getAutoCreate : function(){
+        
+        // no colour highlighting in here....
+        
+        var cfg ={
+            
+            cls : this.lang,
+            
+            cn : [
+                {
+                    tag: 'code',
+                    html :  String.format('{0}',this.code).replace(/\n/g, '<br/>')
+                }
+            ]
+        };
+        
+       
+        return cfg;
+    }
+  
+    
+    
+   
+});
+
+
+ /*
+ * - LGPL
+ *
+ */
+
+/**
+ * @class Roo.doc.Para
+ * @extends Roo.bootstrap.Component
+ * Param Element class
+ * @cfg {String} html
+ * 
+ * @constructor
+ * Create a new Paragraph
+ * @param {Object} config The config object
+ */
+
+Roo.mailer.Para = function(config){
+    Roo.mailer.Para.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.mailer.Para, Roo.bootstrap.Component,  {
+    
+    html : '',
+    getAutoCreate : function(){
+        
+        //?? this is the synopsis type....
+        
+        // this is not very fancy...
+        
+        var cfg ={
+            tag: 'p',
+            cls: 'para',
+            html : this.html
+        };
+         
+        if (this.parent().is_list) {
+            return {
+                tag: 'li',
+                cls : listitme,
+                cn : [ cfg ]
+            };
+            
+        }
+       
+        return cfg;
+    }
+     
+    
+    
+    
+    
+   
+});
+
+
+ /*
+ * - LGPL
+ *
+ */
+
+/**
+ * @class Roo.doc.Param
+ * @extends Roo.bootstrap.Component
+ * Param Element class
+ * @cfg {bool} is_optional 
+ * @cfg {String} type  argument type
+ * @cfg {String} name
+ * @cfg {String} desc  short description
+ * @cfg {String} defaultvalue default value
+ * 
+ * @constructor
+ * Create a new Param
+ * @param {Object} config The config object
+ */
+
+Roo.mailer.Param = function(config){
+    Roo.mailer.Param.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.mailer.Param, Roo.bootstrap.Component,  {
+    
+    is_optional : false,
+    type : '',
+    name: '',
+    defaultvalue:   '',
+    desc: '',
+     
+    getAutoCreate : function(){
+        
+        //?? this is the synopsis type....
+        
+        
+        if (this.parent().stype == 'parameter') {
+            
+            return {
+                tag : 'li',
+                cn : [
+                    {
+                        tag : 'p',
+                        cls: 'para',
+                        cn : [
+                            {
+                                tag: 'code',
+                                html : this.type + ' ' + this.name
+                            },
+                            this.desc
+                        ]
+                    }
+                ]
+            };
+            
+        }
+         if (this.parent().stype == 'return') {
+            return {
+                    tag : 'p',
+                    cls: 'para',
+                    cn : [
+                        {
+                            tag: 'code',
+                            html : this.type
+                        },
+                        this.desc
+                    ]
+                };
+                
+         }
+       
+        
+        
+        // this is not very fancy...
+        
+        var cfg ={
+            tag: 'span',
+            cn : [
+                is_optional ? '[' : '',
+                this.type,
+                ' ',
+                this.name,
+                this.defaultvalue == '' ? '' : ' = ',
+                this.defaultvalue,
+                ',' // not really.. but let's do it anyway...
+            ]
+        };
+         
+        
+        
+       
+        return cfg;
+    }
+     
+    
+    
+    
+    
+   
+});
+
+
+ /*
+ * - LGPL
+ *
+ */
+
+/**
+ * @class Roo.doc.Section
+ * @extends Roo.bootstrap.Component
+ * SectionElement class
+ * @cfg {String} stype (desc|parameter|return|note|example) section type.
+ * 
+ * @constructor
+ * Create a new Synopsis
+ * @param {Object} config The config object
+ */
+
+Roo.mailer.Section = function(config){
+    Roo.mailer.Section.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.mailer.Section, Roo.bootstrap.Component,  {
+    
+    
+    stype:   '',
+     
+    getAutoCreate : function(){
+        
+        var cfg ={
+            
+            cls : 'refsection',
+            // id... ?
+            cn : [
+                {
+                    tag: 'h1',
+                    cls : 'title',
+                    html : this.stype.charAt(0).toUpperCase() + this.stype.slice(1) //ucfirst
+                }
+            ]
+        };
+        if (this.stype == 'parameter') {
+            
+            // db package uses variable list here... - it results in dd/dl but the layout is messed up..
+            cfg.cn.push({
+                tag: 'ul',
+                cls: 'itemizedlist roo-params'
+            });
+        }
+        
+       
+        return cfg;
+    },
+    getChildContainer : function(build_call)
+    {
+         
+        if (this.stype == 'parameter') {
+            return this.el.select('.roo-params',true).first();
+        }
+        return this.el;
+    }
+    
+    
+   
+});
+
+
+ /*
+ * - LGPL
+ *
+ */
+
+/**
+ * @class Roo.doc.Synopsis
+ * @extends Roo.bootstrap.Component
+ * Synopsis Element class
+ * @cfg {String} returntype return value
+ * @cfg {String} name title really..
+ * @cfg {String} stype (function|constant)
+ * 
+ * @constructor
+ * Create a new Synopsis
+ * @param {Object} config The config object
+ */
+
+Roo.mailer.Synopsis = function(config){
+    Roo.mailer.Synopsis.superclass.constructor.call(this, config);
+};
+
+Roo.extend(Roo.mailer.Synopsis, Roo.bootstrap.Component,  {
+    
+    
+    returntype : '',
+    name: '',
+    stype:   'function',
+     
+    getAutoCreate : function(){
+        
+        var cfg ={
+            tag: 'h2',
+            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 cfg;
+    },
+    getChildContainer : function(build_call)
+    {
+         
+        
+        return this.el.select('.roo-params',true).first();
+    }
+    
+    
+    
+    
+   
+});
+
+
\ No newline at end of file
index e69de29..e50bd14 100644 (file)
@@ -0,0 +1,20 @@
+// Roo/doc/Entry.js
+Roo.doc=Roo.doc||{};Roo.mailer.Body=function(A){Roo.mailer.Body.superclass.constructor.call(this,A);var B=Roo.get(document.body);B.attr({leftmargin:0,marginwidth:0,topmargin:0,marginheight:0,offset:0});Roo.mailer.Body._calls++;if(Roo.mailer.Body._calls>1){throw "test";
+}this.onRender(B);this.onRender=function(){};};Roo.mailer.Body._calls=0;Roo.extend(Roo.mailer.Body,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.mailer.Example=function(A){Roo.mailer.Example.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Example,Roo.bootstrap.Component,{lang:'php',code:'',getAutoCreate:function(){var A={cls:this.lang,cn:[{tag:'code',html:String.format('{0}',this.code).replace(/\n/g,'<br/>')}
+]};return A;}});
+// Roo/doc/Para.js
+Roo.mailer.Para=function(A){Roo.mailer.Para.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.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;}});
+// Roo/doc/Param.js
+Roo.mailer.Param=function(A){Roo.mailer.Param.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Param,Roo.bootstrap.Component,{is_optional:false,type:'',name:'',defaultvalue:'',desc:'',getAutoCreate:function(){if(this.parent().stype=='parameter'){return {tag:'li',cn:[{tag:'p',cls:'para',cn:[{tag:'code',html:this.type+' '+this.name}
+,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:[is_optional?'[':'',this.type,' ',this.name,this.defaultvalue==''?'':' = ',this.defaultvalue,',']};return A;}});
+
+// Roo/doc/Section.js
+Roo.mailer.Section=function(A){Roo.mailer.Section.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Section,Roo.bootstrap.Component,{stype:'',getAutoCreate:function(){var A={cls:'refsection',cn:[{tag:'h1',cls:'title',html:this.stype.charAt(0).toUpperCase()+this.stype.slice(1)}
+]};if(this.stype=='parameter'){A.cn.push({tag:'ul',cls:'itemizedlist roo-params'});}return A;},getChildContainer:function(A){if(this.stype=='parameter'){return this.el.select('.roo-params',true).first();}return this.el;}});
+// Roo/doc/Synopsis.js
+Roo.mailer.Synopsis=function(A){Roo.mailer.Synopsis.superclass.constructor.call(this,A);};Roo.extend(Roo.mailer.Synopsis,Roo.bootstrap.Component,{returntype:'',name:'',stype:'function',getAutoCreate:function(){var A={tag:'h2',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 A;},getChildContainer:function(A){return this.el.select('.roo-params',true).first();}});