Comparing version 0.0.3 to 0.0.4
10
index.js
@@ -12,2 +12,8 @@ var args = require("argsparser").parse() | ||
var theme = "deep-ocean" | ||
if(args["-t"]) { | ||
theme = args["-t"] | ||
} | ||
var outPutDir = "docs_out" | ||
@@ -24,3 +30,3 @@ | ||
} | ||
HTMLCompiler.compile(manifest, outPutDir) | ||
HTMLCompiler.compile(manifest, outPutDir, theme) | ||
@@ -45,2 +51,4 @@ } | ||
help += "\n" | ||
help += "-t\t\t the theme to use. Default 'white'. Available: 'white', 'deep-ocean" | ||
help += "\n" | ||
help += "-h\t\t display this " | ||
@@ -47,0 +55,0 @@ |
@@ -12,5 +12,4 @@ | ||
function compile(manifestFilePath, outputDir) { | ||
function compile(manifestFilePath, outputDir, theme) { | ||
var content = fs.readFileSync(manifestFilePath, 'utf8') | ||
@@ -28,2 +27,7 @@ | ||
if(!manifest.prettify) { | ||
console.log("Prettify theme set to default because it is no in your manifest.") | ||
manifest.prettify = "default" | ||
} | ||
for(var i = 0 ; i < manifest.pages.length ; i++) { | ||
@@ -58,3 +62,3 @@ var page = manifest.pages[i] | ||
page.htmlContent = page.htmlContent.replace('<pre>', '<pre class="prettyprint">') | ||
page.htmlContent = page.htmlContent.replace(/<pre><code/gi, '<pre class="prettyprint"><code') | ||
@@ -72,5 +76,5 @@ if(i === 0) { | ||
copyTemplate(outputDir) | ||
copyTemplate(outputDir, theme) | ||
compilePages(outputDir, manifest, function(err) { | ||
compilePages(outputDir, manifest, theme, function(err) { | ||
if(err) { | ||
@@ -86,5 +90,5 @@ console.log(err) | ||
function loadTemplate() { | ||
function loadTemplate(theme) { | ||
// TODO: make template configurable | ||
var templateFile = __dirname+"/template/default/index.html" | ||
var templateFile = __dirname+"/template/"+theme+"/index.html" | ||
var template = fs.readFileSync(templateFile, 'utf8') | ||
@@ -95,5 +99,5 @@ var compiled = dust.compile(template, "template") | ||
function compilePages(targetDir, manifest, callback) { | ||
function compilePages(targetDir, manifest, theme, callback) { | ||
loadTemplate() | ||
loadTemplate(theme) | ||
@@ -165,3 +169,3 @@ var runner = new SerialRunner() | ||
function copyTemplate(targetDir) { | ||
function copyTemplate(targetDir, theme) { | ||
@@ -173,5 +177,5 @@ if(!fs.existsSync(targetDir)) { | ||
wrench.copyDirSyncRecursive(__dirname+"/template/default", targetDir) | ||
wrench.copyDirSyncRecursive(__dirname+"/template/"+theme, targetDir) | ||
} | ||
exports.compile = compile |
{ | ||
"name": "doctasia", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"author": "Nicolas Herment <nherment@gmail.com>", | ||
@@ -5,0 +5,0 @@ "preferGlobal": "true", |
@@ -20,3 +20,3 @@ **Doctasia** is a straightforward static website generator for Markdown documentation. | ||
``` | ||
```json | ||
{ | ||
@@ -45,2 +45,2 @@ "title": "Doctasia", /* the website title */ | ||
- color highlighting of code snippets | ||
- better UI | ||
- better UI |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1212857
90
22871
45
1