4 * Documentation - designed to generate HTML+Docbook!?!
6 Roo.doc = Roo.doc || {};
10 * @extends Roo.bootstrap.Component
11 * Entry Element class - describes a method etc...
12 * @cfg name {String} name of method
13 * @cfg purpose {String} short description of method.
17 * @param {Object} config The config object
22 Roo.doc.Entry = function(config){
23 Roo.doc.Entry.superclass.constructor.call(this, config);
24 //this.el = Roo.get(document.body);
25 var body = Roo.get(document.body);
35 // call onRender once... and block next call...?
38 //this.onRender = function() { };
42 Roo.doc.Entry._calls = 0;
44 Roo.extend(Roo.doc.Entry, Roo.bootstrap.Component, {
50 getAutoCreate : function(){
73 addxtype : function (tree, cntr)
75 return this.addxtypeChild(tree,cntr);
78 onRender : function(ct, position)
81 Roo.doc.Entry._calls++;
82 if (Roo.doc.Entry._calls > 1 || !ct) {
86 // call onRender once... and block next call...?
88 Roo.bootstrap.Component.prototype.onRender.call(this, ct, position);
101 * @class Roo.doc.Example
102 * @extends Roo.bootstrap.Component
103 * Example Element class
104 * @cfg {String} title short title describing example
105 * @cfg {String} lang (php|txt|sql) section type.
106 * @cfg {String} code example code
107 * @cfg {String} output The expected output from the code
111 * Create a new Synopsis
112 * @param {Object} config The config object
115 Roo.doc.Example = function(config){
116 Roo.doc.Example.superclass.constructor.call(this, config);
119 Roo.extend(Roo.doc.Example, Roo.bootstrap.Component, {
126 getAutoCreate : function(){
128 // no colour highlighting in here....
131 cls : 'panel panel-info',
134 cls : 'panel-heading',
142 cls : 'lang-' + this.lang,
143 html : String.format('{0}',this.code).replace(/\n/g, '<br/>')
154 cls : 'panel-footer',
157 html : String.format('{0}',this.output).replace(/\n/g, '<br/>')
183 * @class Roo.doc.Para
184 * @extends Roo.bootstrap.Component
185 * Param Element class
189 * Create a new Paragraph
190 * @param {Object} config The config object
193 Roo.doc.Para = function(config){
194 Roo.doc.Para.superclass.constructor.call(this, config);
197 Roo.extend(Roo.doc.Para, Roo.bootstrap.Component, {
200 getAutoCreate : function(){
202 //?? this is the synopsis type....
204 // this is not very fancy...
212 if (this.parent().is_list) {
239 * @class Roo.doc.Param
240 * @extends Roo.bootstrap.Component
241 * Param Element class
242 * @cfg {bool} is_optional is the argument optional
243 * @cfg {String} type argument type
244 * @cfg {String} name name of the parameter
245 * @cfg {String} desc short description
246 * @cfg {String} defaultvalue default value
250 * @param {Object} config The config object
253 Roo.doc.Param = function(config){
254 Roo.doc.Param.superclass.constructor.call(this, config);
257 Roo.extend(Roo.doc.Param, Roo.bootstrap.Component, {
265 getAutoCreate : function(){
267 //?? this is the synopsis type....
270 if (this.parent().stype == 'parameter') {
281 html : this.type + ' ' + this.name
290 if (this.parent().stype == 'return') {
307 // this is not very fancy...
312 this.is_optional ? '[' : '',
319 this.defaultvalue == '' ? '' : ' = ',
321 this.is_optional ? ']' : '',
322 ',' // not really.. but let's do it anyway...
331 getAutoCreateParamSection : function()
342 html : this.type + ' ' + this.name
369 * @class Roo.doc.Section
370 * @extends Roo.bootstrap.Component
371 * SectionElement class
372 * @cfg {String} stype (desc|parameter|return|note|example) section type.
375 * Create a new Synopsis
376 * @param {Object} config The config object
379 Roo.doc.Section = function(config){
380 Roo.doc.Section.superclass.constructor.call(this, config);
383 Roo.extend(Roo.doc.Section, Roo.bootstrap.Component, {
388 getAutoCreate : function(){
401 html : Roo.doc.Section.map[this.stype]
405 if (this.stype == 'parameter') {
407 // db package uses variable list here... - it results in dd/dl but the layout is messed up..
411 cls: 'itemizedlist roo-params',
414 // might not have any..
415 var params = this.parent().items[0].items;
416 for (var i =0; i < params.length;i++) {
417 ul.cn.push( Roo.factory(params[i]).getAutoCreateParamSection() )
427 getChildContainer : function(build_call)
430 if (this.stype == 'parameter') {
431 return this.el.select('.roo-params',true).first();
441 Roo.doc.Section.map = {
442 'desc' : 'Description',
443 'parameter' : 'Parameters',
444 'return' : 'Return Value',
446 'example' : 'Examples'
454 * @class Roo.doc.Synopsis
455 * @extends Roo.bootstrap.Component
456 * Synopsis Element class
457 * @cfg {String} returntype return value
458 * @cfg {String} name title really..
459 * @cfg {String} stype (function|constant)
460 * @cfg {String} memberof class name
461 * @cfg {bool} is_static is a static member
464 * Create a new Synopsis
465 * @param {Object} config The config object
468 Roo.doc.Synopsis = function(config){
469 Roo.doc.Synopsis.superclass.constructor.call(this, config);
472 Roo.extend(Roo.doc.Synopsis, Roo.bootstrap.Component, {
480 getAutoCreate : function(){
482 var syn = this.items[0]; // hopefully...
488 cls : 'refsynopsisdiv',
497 cls : 'funcprototype',
499 this.returntype + ' ',
525 getChildContainer : function(build_call)
529 return this.el.select('.roo-params',true).first();