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....
130 var code = hljs ? hljs.highlight(this.code, this.lang.toUpperCase()) : String.format('{0}',this.code).replace(/\n/g, '<br/>');
134 cls : 'panel panel-info',
137 cls : 'panel-heading',
145 cls : 'lang-' + this.lang,
157 cls : 'panel-footer',
160 html : String.format('{0}',this.output).replace(/\n/g, '<br/>')
186 * @class Roo.doc.Para
187 * @extends Roo.bootstrap.Component
188 * Param Element class
192 * Create a new Paragraph
193 * @param {Object} config The config object
196 Roo.doc.Para = function(config){
197 Roo.doc.Para.superclass.constructor.call(this, config);
200 Roo.extend(Roo.doc.Para, Roo.bootstrap.Component, {
203 getAutoCreate : function(){
205 //?? this is the synopsis type....
207 // this is not very fancy...
215 if (this.parent().is_list) {
242 * @class Roo.doc.Param
243 * @extends Roo.bootstrap.Component
244 * Param Element class
245 * @cfg {bool} is_optional is the argument optional
246 * @cfg {String} type argument type
247 * @cfg {String} name name of the parameter
248 * @cfg {String} desc short description
249 * @cfg {String} defaultvalue default value
253 * @param {Object} config The config object
256 Roo.doc.Param = function(config){
257 Roo.doc.Param.superclass.constructor.call(this, config);
260 Roo.extend(Roo.doc.Param, Roo.bootstrap.Component, {
268 getAutoCreate : function(){
270 //?? this is the synopsis type....
273 if (this.parent().stype == 'parameter') {
284 html : this.type + ' ' + this.name
293 if (this.parent().stype == 'return') {
310 // this is not very fancy...
315 this.is_optional ? '[' : '',
322 this.defaultvalue == '' ? '' : ' = ',
324 this.is_optional ? ']' : '',
325 ',' // not really.. but let's do it anyway...
334 getAutoCreateParamSection : function()
345 html : this.type + ' ' + this.name
372 * @class Roo.doc.Section
373 * @extends Roo.bootstrap.Component
374 * SectionElement class
375 * @cfg {String} stype (desc|parameter|return|note|example) section type.
378 * Create a new Synopsis
379 * @param {Object} config The config object
382 Roo.doc.Section = function(config){
383 Roo.doc.Section.superclass.constructor.call(this, config);
386 Roo.extend(Roo.doc.Section, Roo.bootstrap.Component, {
391 getAutoCreate : function(){
404 html : Roo.doc.Section.map[this.stype]
408 if (this.stype == 'parameter') {
410 // db package uses variable list here... - it results in dd/dl but the layout is messed up..
414 cls: 'itemizedlist roo-params',
417 // might not have any..
418 var params = this.parent().items[0].items;
419 for (var i =0; i < params.length;i++) {
420 ul.cn.push( Roo.factory(params[i]).getAutoCreateParamSection() )
430 getChildContainer : function(build_call)
433 if (this.stype == 'parameter') {
434 return this.el.select('.roo-params',true).first();
444 Roo.doc.Section.map = {
445 'desc' : 'Description',
446 'parameter' : 'Parameters',
447 'return' : 'Return Value',
449 'example' : 'Examples'
457 * @class Roo.doc.Synopsis
458 * @extends Roo.bootstrap.Component
459 * Synopsis Element class
460 * @cfg {String} returntype return value
461 * @cfg {String} name title really..
462 * @cfg {String} stype (function|constant)
463 * @cfg {String} memberof class name
464 * @cfg {bool} is_static is a static member
467 * Create a new Synopsis
468 * @param {Object} config The config object
471 Roo.doc.Synopsis = function(config){
472 Roo.doc.Synopsis.superclass.constructor.call(this, config);
475 Roo.extend(Roo.doc.Synopsis, Roo.bootstrap.Component, {
483 getAutoCreate : function(){
485 var syn = this.items[0]; // hopefully...
491 cls : 'refsynopsisdiv',
500 cls : 'funcprototype',
502 this.returntype + ' ',
528 getChildContainer : function(build_call)
532 return this.el.select('.roo-params',true).first();