11var marked = require ( 'marked' ) ;
22
3- var docHeaderRegex = / ^ \s * - { 3 , } \n ( [ \W \w ] + ?) \n \s * - { 3 , } / ;
4- var docHeaderLineRegex = / ( [ A - z ] [ \w - ] * ) \s * : \s * ( [ ^ \n ] + ) / g;
3+ var headerRegex = / ^ \s * - { 3 , } \n ( [ \W \w ] + ?) \n \s * - { 3 , } / ;
4+ var headerLineRegex = / ( [ A - z ] [ \w - ] * ) \s * : \s * ( [ ^ \n ] + ) / g;
55
66function titleToName ( string ) {
77 return string . replace ( / \s + / g, '_' ) . replace ( / [ ^ A - z 0 - 9 _ ] / g, '' ) . toLowerCase ( ) ;
88}
99
10- function Section ( node ) {
10+ function Documentation ( node ) {
1111 var self = this ;
1212
1313 if ( node . type === 'comment' ) {
14- self . content = marked ( node . text . replace ( docHeaderRegex , function ( headerMatch , lines ) {
15- lines . replace ( docHeaderLineRegex , function ( headerLineMatch , name , value ) {
14+ self . content = marked ( node . text . replace ( headerRegex , function ( headerMatch , lines ) {
15+ lines . replace ( headerLineRegex , function ( headerLineMatch , name , value ) {
1616 self [ name ] = value . trim ( ) ;
1717 } ) ;
1818
@@ -29,8 +29,8 @@ function Section(node) {
2929 var hash = { } ;
3030
3131 node . walkComments ( function ( comment ) {
32- if ( docHeaderRegex . test ( comment . text ) ) {
33- var section = new Section ( comment ) ;
32+ if ( headerRegex . test ( comment . text ) ) {
33+ var section = new Documentation ( comment ) ;
3434
3535 hash [ section . title ] = section ;
3636 }
@@ -47,7 +47,7 @@ function Section(node) {
4747 var parent = hash [ title ] ;
4848
4949 if ( ! parent ) {
50- parent = hash [ title ] = new Section ( section . css . clone ( { text : '' } ) ) ;
50+ parent = hash [ title ] = new Documentation ( section . css . clone ( { text : '' } ) ) ;
5151
5252 parent . title = title ;
5353 parent . name = titleToName ( title ) ;
@@ -61,4 +61,4 @@ function Section(node) {
6161 }
6262}
6363
64- module . exports = Section ;
64+ module . exports = Documentation ;
0 commit comments