From 40f86376b2fb83dfd6a0b7fc97ff947d44b9204b Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 13 Oct 2016 15:58:47 +0800 Subject: [PATCH] Roo/doc/Entry.js roojs-doc.js roojs-doc-debug.js --- Roo/doc/Entry.js | 11 +++++---- roojs-doc-debug.js | 61 +++++++++++++++++++++++++++++++++++----------- roojs-doc.js | 24 +++++++++--------- 3 files changed, 65 insertions(+), 31 deletions(-) diff --git a/Roo/doc/Entry.js b/Roo/doc/Entry.js index 6ecd411513..da7a78c61f 100644 --- a/Roo/doc/Entry.js +++ b/Roo/doc/Entry.js @@ -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); } + */ }); diff --git a/roojs-doc-debug.js b/roojs-doc-debug.js index 4dadd852b4..cef952b3a1 100644 --- a/roojs-doc-debug.js +++ b/roojs-doc-debug.js @@ -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, '
'); + var code = hljs ? hljs.highlight(this.lang,this.code).value : + String.format('{0}',this.code).replace(/\n/g, '
'); 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, '
'); cfg.cn.push( { cls : 'panel-footer', cn : { - tag: 'code', - html : String.format('{0}',this.output).replace(/\n/g, '
') + 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, diff --git a/roojs-doc.js b/roojs-doc.js index 6dbcbcd7ee..9d2efb55ef 100644 --- a/roojs-doc.js +++ b/roojs-doc.js @@ -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,'
'); -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,'
')} -});}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,'
'); +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,'
'); +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');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();}}); -- 2.39.2