<!DOCTYPE html>
<html>
<head>
- <title>{{section}} - Node.js Manual & Documentation</title>
+ <title>{{section}}Node.js Manual & Documentation</title>
<link rel="stylesheet" href="assets/style.css" type="text/css" media="all" />
<link rel="stylesheet" href="assets/sh.css" type="text/css" media="all"/>
<script type="text/javascript" src="assets/jquery.js"></script>
<header>
<h1>Node.js Manual & Documentation</h1>
<div id="gtoc">
- <p><a href="index.html">Table of Contents</a></p>
+ <p><a href="index.html">Table of Contents</a> | <a href="all.html">View on single page</a></p>
</div>
<hr />
</header>
+++ /dev/null
-<!DOCTYPE html>
-<html>
-<head>
- <title>Node.js Manual & Documentation</title>
- <link rel="stylesheet" href="assets/style.css" type="text/css" media="all" />
- <link rel="stylesheet" href="assets/sh.css" type="text/css" media="all"/>
- <script type="text/javascript" src="assets/jquery.js"></script>
-</head>
-<body>
- <div id="container">
- <header>
- <h1>Node.js Manual & Documentation</h1>
- <hr />
- </header>
- {{content}}
- </div>
- <script type="text/javascript" src="assets/sh_main.js"></script>
- <script type="text/javascript" src="assets/sh_javascript.min.js"></script>
- <script type="text/javascript" src="assets/core.js"></script>
-</body>
-</html>
\ No newline at end of file
/*
Loads the template for which the documentation should be outputed into.
*/
-var template_index, template_page;
+var template;
function loadTemplates(next){
- var templates_path = path.join(doc_root, "..", "template");
-
- fs.readFile(templates_path+"_page.html", "utf8", function(err, data){
- if(err) throw err;
+ fs.readFile(path.join(doc_root, "../template.html"), "utf8", function(e, d){
+ if(e) throw e;
- template_page = data;
-
- fs.readFile(templates_path+"_index.html", "utf8", function(err, data){
- if(err) throw err;
-
- template_index = data;
- next();
- });
+ template = d;
+ next();
});
};
files.filter(function(file){
var basename = path.basename(file, ".markdown");
return path.extname(file) == ".markdown" &&
- basename != "index" &&
- basename != "_toc";
+ basename.substr(0,1) != "_";
}).forEach(function(file){
var filename = path.basename(file, '.markdown')
, build_path = path.join(build_root, filename+".html")
// do conversion stuff.
var html = convertData(data);
- var output = template_page
- .replace("{{section}}", filename)
- .replace("{{content}}", html);
+ var output = template.replace("{{content}}", html);
+
+ if(filename == "index"){
+ output = output.replace("{{section}}", "");
+ } else {
+ output = output.replace("{{section}}", filename+" - ")
+ }
fs.writeFile(build_path, output, function(err){
if(err) throw err;
next();
};
-function createIndex(next){
- fs.readFile(path.join(doc_root, "index.markdown"), "utf8", function(err, data){
- if(err) throw err;
-
- // do conversion stuff.
- var html = convertData(data);
- var output = template_index.replace("{{content}}", html);
-
- fs.writeFile(path.join(build_root, "index.html"), output, function(err){
- if(err) throw err;
- });
- });
- // one again, no need to wait.
- next();
-};
-
function copyAssets(next){
cp.exec("cp -R "+assets_path+" "+bassets_path, function(err, stdout, stderr){
next();
checkdir,
copyAssets,
loadTemplates,
- convertFiles,
- createIndex
+ convertFiles
)();
\ No newline at end of file