mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Add comments and cleanup build-site.js.
This commit is contained in:
@@ -11,12 +11,19 @@ var basePath = path.join(__dirname, '..', '..'),
|
||||
readmePath = path.join(docPath, 'README.md');
|
||||
|
||||
function build(type) {
|
||||
var $ = marky(fs.readFileSync(readmePath, 'utf8'), { 'sanitize': false }),
|
||||
// Load markddown and uncomment docdown HTML hints.
|
||||
var markdown = fs
|
||||
.readFileSync(readmePath, 'utf8')
|
||||
.replace(/(<)!--\s*|\s*--(>)/g, '$1$2');
|
||||
|
||||
var $ = marky(markdown),
|
||||
$header = $('h1').first().remove(),
|
||||
version = _.trim($header.find('span').first().text()).slice(1);
|
||||
|
||||
// Remove docdown horizontal rules.
|
||||
$('hr').remove();
|
||||
|
||||
// Remove marky-markdown additions.
|
||||
$('[id^="user-content-"]')
|
||||
.attr('class', null)
|
||||
.attr('id', null);
|
||||
@@ -26,9 +33,8 @@ function build(type) {
|
||||
$a.replaceWith($a.html());
|
||||
});
|
||||
|
||||
var html = _.trim($.html().replace(/(<)!--\s*|\s*--(>)/g, '$1$2'));
|
||||
|
||||
html = [
|
||||
// Append YAML front matter.
|
||||
var html = [
|
||||
'---',
|
||||
'id: docs',
|
||||
'layout: docs',
|
||||
@@ -36,7 +42,7 @@ function build(type) {
|
||||
'version: ' + (version || null),
|
||||
'---',
|
||||
'',
|
||||
html,
|
||||
_.trim($.html()),
|
||||
].join('\n');
|
||||
|
||||
fs.writeFile(path.join(docPath, version + '.html'), html, util.pitch);
|
||||
|
||||
Reference in New Issue
Block a user