Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
doc, tool: extract getSection
  • Loading branch information
eljefedelrodeodeljefe committed May 25, 2016
commit b222a7e2ef9b250395a746002771a4097d3c8a60
9 changes: 1 addition & 8 deletions tools/doc/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const parseLists = require('./lib/parseLists')
const parseYAML = require('./lib/parseYAML')
const linkJsTypeDocs = require('./lib/linkJsTypeDocs')
const parseAPIHeader = require('./lib/parseAPIHeader')
const getSection = require('./lib/getSection')

module.exports = toHTML;

Expand All @@ -30,14 +31,6 @@ marked.setOptions({
});


// section is just the first heading
function getSection(lexed) {
for (var i = 0, l = lexed.length; i < l; i++) {
var tok = lexed[i];
if (tok.type === 'heading') return tok.text;
}
return '';
}


function buildToc(lexed, filename, cb) {
Expand Down
9 changes: 9 additions & 0 deletions tools/doc/lib/getSection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

// section is just the first heading
module.exports = function getSection(lexed) {
for (var i = 0, l = lexed.length; i < l; i++) {
var tok = lexed[i];
if (tok.type === 'heading') return tok.text;
}
return '';
}