@@ -222,11 +222,12 @@ Doc.prototype = {
222
222
if ( ! match ) {
223
223
throw new Error ( "Not a valid 'property' format: " + text ) ;
224
224
}
225
- var property = {
225
+ var property = new Doc ( {
226
226
type : match [ 1 ] ,
227
227
name : match [ 2 ] ,
228
+ shortName : match [ 2 ] ,
228
229
description : self . markdown ( text . replace ( match [ 0 ] , match [ 4 ] ) )
229
- } ;
230
+ } ) ;
230
231
self . properties . push ( property ) ;
231
232
} else if ( atName == 'eventType' ) {
232
233
match = text . match ( / ^ ( [ ^ \s ] * ) \s + o n \s + ( [ \S \s ] * ) / ) ;
@@ -482,44 +483,60 @@ Doc.prototype = {
482
483
483
484
method_properties_events : function ( dom ) {
484
485
var self = this ;
485
- dom . h ( 'Methods' , this . methods , function ( method ) {
486
- var signature = ( method . param || [ ] ) . map ( property ( 'name' ) ) ;
487
- dom . h ( method . shortName + '(' + signature . join ( ', ' ) + ')' , method , function ( ) {
488
- dom . html ( method . description ) ;
489
- method . html_usage_parameters ( dom ) ;
490
- self . html_usage_this ( dom ) ;
491
- method . html_usage_returns ( dom ) ;
492
-
493
- dom . h ( 'Example' , method . example , dom . html ) ;
494
- } ) ;
495
- } ) ;
496
- dom . h ( 'Properties' , this . properties , function ( property ) {
497
- dom . h ( property . shortName , function ( ) {
498
- dom . html ( property . description ) ;
499
- dom . h ( 'Example' , property . example , dom . html ) ;
500
- } ) ;
501
- } ) ;
502
- dom . h ( 'Events' , this . events , function ( event ) {
503
- dom . h ( event . shortName , event , function ( ) {
504
- dom . html ( event . description ) ;
505
- if ( event . type == 'listen' ) {
506
- dom . tag ( 'div' , { class :'inline' } , function ( ) {
507
- dom . h ( 'Listen on:' , event . target ) ;
508
- } ) ;
509
- } else {
510
- dom . tag ( 'div' , { class :'inline' } , function ( ) {
511
- dom . h ( 'Type:' , event . type ) ;
486
+ if ( self . methods . length ) {
487
+ dom . div ( { class :'member method' } , function ( ) {
488
+ dom . h ( 'Methods' , self . methods , function ( method ) {
489
+ var signature = ( method . param || [ ] ) . map ( property ( 'name' ) ) ;
490
+ dom . h ( method . shortName + '(' + signature . join ( ', ' ) + ')' , method , function ( ) {
491
+ dom . html ( method . description ) ;
492
+ method . html_usage_parameters ( dom ) ;
493
+ self . html_usage_this ( dom ) ;
494
+ method . html_usage_returns ( dom ) ;
495
+
496
+ dom . h ( 'Example' , method . example , dom . html ) ;
512
497
} ) ;
513
- dom . tag ( 'div' , { class :'inline' } , function ( ) {
514
- dom . h ( 'Target:' , event . target ) ;
498
+ } ) ;
499
+ } ) ;
500
+ }
501
+ if ( self . properties . length ) {
502
+ dom . div ( { class :'member property' } , function ( ) {
503
+ dom . h ( 'Properties' , self . properties , function ( property ) {
504
+ dom . h ( property . shortName , function ( ) {
505
+ dom . html ( property . description ) ;
506
+ if ( ! property . html_usage_returns ) {
507
+ console . log ( property ) ;
508
+ }
509
+ property . html_usage_returns ( dom ) ;
510
+ dom . h ( 'Example' , property . example , dom . html ) ;
515
511
} ) ;
516
- }
517
- event . html_usage_parameters ( dom ) ;
518
- self . html_usage_this ( dom ) ;
512
+ } ) ;
513
+ } ) ;
514
+ }
515
+ if ( self . events . length ) {
516
+ dom . div ( { class :'member event' } , function ( ) {
517
+ dom . h ( 'Events' , self . events , function ( event ) {
518
+ dom . h ( event . shortName , event , function ( ) {
519
+ dom . html ( event . description ) ;
520
+ if ( event . type == 'listen' ) {
521
+ dom . tag ( 'div' , { class :'inline' } , function ( ) {
522
+ dom . h ( 'Listen on:' , event . target ) ;
523
+ } ) ;
524
+ } else {
525
+ dom . tag ( 'div' , { class :'inline' } , function ( ) {
526
+ dom . h ( 'Type:' , event . type ) ;
527
+ } ) ;
528
+ dom . tag ( 'div' , { class :'inline' } , function ( ) {
529
+ dom . h ( 'Target:' , event . target ) ;
530
+ } ) ;
531
+ }
532
+ event . html_usage_parameters ( dom ) ;
533
+ self . html_usage_this ( dom ) ;
519
534
520
- dom . h ( 'Example' , event . example , dom . html ) ;
535
+ dom . h ( 'Example' , event . example , dom . html ) ;
536
+ } ) ;
537
+ } ) ;
521
538
} ) ;
522
- } ) ;
539
+ }
523
540
} ,
524
541
525
542
parameters : function ( dom , separator , skipFirst , prefix ) {
0 commit comments