styledocco
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -59,9 +59,15 @@ (function() { | ||
generateFile = function(source, data) { | ||
var dest, lang, render; | ||
if (source.match(/readme/i)) source = 'index.html'; | ||
dest = _.makeDestination(source); | ||
var dest, lang, render, root; | ||
if (source.match(/readme/i)) { | ||
source = 'index.html'; | ||
dest = _.makeDestination(source); | ||
root = './'; | ||
} else { | ||
dest = 'html/' + _.makeDestination(source); | ||
root = '../'; | ||
} | ||
data.project = { | ||
name: options.name, | ||
menu: menu, | ||
root: _.buildRootPath(source) | ||
root: root | ||
}; | ||
@@ -111,3 +117,3 @@ render = function(data) { | ||
name: path.basename(file, path.extname(file)), | ||
href: _.makeDestination(file) | ||
href: 'html/' + _.makeDestination(file) | ||
}; | ||
@@ -114,0 +120,0 @@ parts = file.split('/').splice(1); |
@@ -13,16 +13,5 @@ (function() { | ||
exports.makeDestination = function(file) { | ||
return path.join(path.dirname(file), path.basename(file, path.extname(file)) + '.html'); | ||
return path.join(path.dirname(file), path.basename(file, path.extname(file)) + '.html').replace(/[\\/]/g, '-'); | ||
}; | ||
exports.buildRootPath = function(str) { | ||
var root; | ||
if (path.dirname(str) === '.') { | ||
root = path.dirname(str); | ||
} else { | ||
root = path.dirname(str).replace(/[^\/]+/g, '..'); | ||
} | ||
if (root.slice(-1) !== '/') root += '/'; | ||
return root; | ||
}; | ||
exports.findFile = function(dir, re) { | ||
@@ -34,9 +23,6 @@ var file, _ref; | ||
})) != null ? _ref[0] : void 0; | ||
if (file != null) { | ||
return path.join(dir, file); | ||
} else { | ||
return null; | ||
} | ||
if (file == null) return null; | ||
return path.join(dir, file); | ||
}; | ||
}).call(this); |
@@ -9,3 +9,3 @@ { | ||
"author": "Jacob Rask <jacob@jacobrask.net>", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"homepage": "http://jacobrask.github.com/styledocco/", | ||
@@ -12,0 +12,0 @@ "licenses": [ |
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
635792
73
1525