File tree Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Expand file tree Collapse file tree 2 files changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ var _ = require('lodash');
22
33var langs = require ( './langs' ) ;
44
5- function section2obj {
5+ function section2obj ( section ) {
66 var nonCodeNodes = _ . reject ( section , {
77 'type' : 'code'
88 } ) ;
@@ -12,17 +12,17 @@ function section2obj {
1212 } ) ;
1313
1414 // Languages in code blocks
15- var langs = _ . pluck ( codeNodes , 'lang' ) . map ( langs . normalize ) ;
15+ var _langs = _ . pluck ( codeNodes , 'lang' ) . map ( langs . normalize ) ;
1616
1717 // Check that they are all the same
18- var validLangs = _ . all ( _ . map ( langs , function ( lang ) {
18+ var validLangs = _ . all ( _ . map ( _langs , function ( lang ) {
1919 return lang && lang === langs [ 0 ] ;
2020 } ) ) ;
2121
2222 // Main language
23- var lang = validLangs ? langs [ 0 ] : null ;
23+ var lang = validLangs ? _langs [ 0 ] : null ;
2424
25- return { ,
25+ return {
2626 content : nonCodeNodes ,
2727 lang : lang ,
2828 code : {
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ var _ = require('lodash');
44function split ( nodes ) {
55 var section = [ ] ;
66
7- return _ ( nodes )
8- . reduce ( , function ( sections , el ) {
7+ return _ . chain ( nodes )
8+ . reduce ( function ( sections , el ) {
99 if ( el . type === 'hr' ) {
1010 sections . push ( section ) ;
1111 section = [ ] ;
@@ -28,7 +28,7 @@ function join(sections) {
2828 var nodes = _ . reduce ( sections , function ( nodes , section ) {
2929 return nodes . concat ( section ) ;
3030 } , [ ] ) ;
31- nodes . links = ( sections [ 0 ] && ( sections [ 0 ] . links ) || { } ;
31+ nodes . links = ( sections [ 0 ] && ( sections [ 0 ] . links ) || { } ) ;
3232 return nodes ;
3333}
3434
You can’t perform that action at this time.
0 commit comments