markdown-styles
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -7,2 +7,3 @@ module.exports = { | ||
annotateStructured: require('./list-tasks/annotate-structured.js'), | ||
annotateInputOutputPaths: require('./list-tasks/annotate-input-output-paths.js'), | ||
mkdirOutputStructured: require('./list-tasks/mkdir-output-structured.js'), | ||
@@ -9,0 +10,0 @@ copyAssets: require('./misc-tasks/copy-assets.js'), |
@@ -28,4 +28,8 @@ var path = require('path'); | ||
// clone the object | ||
var item = JSON.parse(JSON.stringify(obj)); | ||
item.relname = pathParts[pathParts.length - 1 ]; | ||
// the last part is the file name - store under { ".": [ filename, filename ] } | ||
current['.'] = (current['.'] ? current['.'] : [] ).concat(pathParts[pathParts.length - 1 ]); | ||
current['.'] = (current['.'] ? current['.'] : [] ).concat(item); | ||
@@ -32,0 +36,0 @@ }); |
@@ -10,7 +10,8 @@ var fs = require('fs'), | ||
ncp.limit = 16; | ||
ncp(from, to, { filter: function(file) { | ||
copied.push(file); | ||
return true; | ||
} | ||
}, | ||
ncp(from, to, { | ||
filter: function(file) { | ||
copied.push(file); | ||
return true; | ||
} | ||
}, | ||
function (err) { | ||
@@ -29,2 +30,4 @@ if (err) { | ||
}); | ||
} else { | ||
console.log('Assets path does not exist: ' + from); | ||
} | ||
@@ -31,0 +34,0 @@ } |
@@ -9,2 +9,3 @@ var fs = require('fs'), | ||
annotateStructured = require('./list-tasks/annotate-structured.js'), | ||
annotateInputOutputPaths = require('./list-tasks/annotate-input-output-paths.js'), | ||
copyAssets = require('./misc-tasks/copy-assets.js'), | ||
@@ -21,3 +22,8 @@ merge = require('./misc-tasks/merge-hash.js'), | ||
list.files = list.files.filter(function(item) { | ||
return path.extname(item.name) == '.md'; | ||
}); | ||
annotateBasepath(list); | ||
annotateInputOutputPaths(list, { basepath: list.basepath, input: options.input, output: output }); | ||
annotateStructured(list); | ||
@@ -34,17 +40,18 @@ | ||
// check that the output dir exists | ||
var fulloutpath = path.resolve(cwd, path.dirname(item.name.replace(list.basepath, output + path.sep))), | ||
fullpath = fulloutpath + path.sep + path.basename(item.name, '.md') + '.html', | ||
meta = {}, | ||
var meta = {}, | ||
last, | ||
relpath = item.name.replace(options.input, ''), | ||
isDirectory = (relpath.indexOf('/') > -1), | ||
projectName = (isDirectory ? path.dirname(relpath) : path.basename(relpath, '.md')); | ||
relpath = item.relative; | ||
if(!fs.existsSync(fulloutpath)) { | ||
mkdirp.sync(fulloutpath); | ||
if(!fs.existsSync(item.outputDir)) { | ||
mkdirp.sync(item.outputDir); | ||
} | ||
// merge in defaultMeta and project metadata | ||
meta = merge(meta, options.defaultMeta, metaFile[projectName]); | ||
meta = merge(meta, options.defaultMeta, metaFile[item.projectName]); | ||
// determine the relative path to ./output/assets | ||
// -- since files can be in subdirs like: sub/sub/dir/index.html | ||
meta.assetsRelative = path.relative( item.outputDir, options.output + '/assets/' ); | ||
// create a readable stream | ||
@@ -60,10 +67,16 @@ // run the markdown generation task | ||
console.log(path.relative(cwd, item.name), '->', path.relative(cwd, fullpath)); | ||
console.log(path.relative(cwd, item.name), '->', path.relative(cwd, item.outputFull)); | ||
// write the output to disk | ||
last.stdout.pipe(fs.createWriteStream(fullpath)); | ||
last.stdout.pipe(fs.createWriteStream(item.outputFull)); | ||
}); | ||
// copy assets | ||
copyAssets(options.layout+'/assets/', output+'/assets/'); | ||
// 1) lookup from the dir in which the template is | ||
if(fs.existsSync(path.dirname(options.template) + '/assets/')) { | ||
copyAssets(path.dirname(options.template) + '/assets/', output+'/assets/'); | ||
} else { | ||
// 2) try the builtin template dir | ||
copyAssets(__dirname + '/../layouts/' + options.layout+'/assets/', output+'/assets/'); | ||
} | ||
}; | ||
{ | ||
"name": "markdown-styles", | ||
"description": "CSS stylesheets for markdown content", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Mikito Takada", |
@@ -86,2 +86,6 @@ # markdown-styles | ||
### mixu-gray (new!) | ||
 | ||
### thomasf-solarizedcssdark | ||
@@ -88,0 +92,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
4613590
150
58311
121
3