Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ module.exports = function (txt, filename, sourceFileName) {
inside = false;
eve("doc.end." + mode, null, mode, "");
itemData.line = line + 1;
itemData.sourceFileName = sourceFileName;
(function (value, Clas, data, pointer) {
eve.on("doc.item", function () {
if (this == pointer) {
Expand Down
13 changes: 10 additions & 3 deletions dr.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/usr/bin/env node

// Copyright (c) 2013 Adobe Systems Incorporated. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -22,6 +24,7 @@ var fs = require("fs"),
format = require("./formatter.js"),
dot = require("dot"),
_ref = require("child_process"),
mkdirp = require("mkdirp"),
// spawn = _ref.spawn,
exec = _ref.exec;

Expand Down Expand Up @@ -156,7 +159,8 @@ if (!files.length) {
}
json.template = json.template && path.resolve(pth, json.template);
output = path.resolve(pth, json.output) || "";
pth = output.substring(0, output.length - path.basename(output).length);
pth = path.dirname(output) + '/';
mkdirp.sync(pth, 0755);
if (json.css != "custom") {
exec("mkdir " + pth + "js " + pth + "css " + pth + "fonts " + pth + "img");
exec("cp " + __dirname + "/node_modules/topcoat/css/topcoat-mobile-light.css " + pth + "css/topcoat-desktop-light.css");
Expand Down Expand Up @@ -225,8 +229,11 @@ if (!files.length) {
toc: betterTOC
});

fs.writeFile(output || (getPath(fileName) + ".html"), html, function () {
console.log("Saved to \033[32m" + (output || getPath(fileName) + ".html") + "\033[0m\n");
output = output || (getPath(fileName) + ".html");
mkdirp.sync(path.dirname(output), 0755);

fs.writeFile(output, html, function () {
console.log("Saved to \033[32m" + output + "\033[0m\n");
});
}

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"dependencies": {
"eve": "*",
"markdown": "*",
"mkdirp": "^0.5.1",
"topcoat": "*",
"dot": "*"
},
Expand Down
2 changes: 1 addition & 1 deletion template.dot
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
{{~it.out :item:index}}
<article id="{{=item[0].title}}">
<header>
<h3 class="{{=item[0].clas}}">{{=item[0].name}}<a href="#{{=item[0].title}}" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line {{=item[0].line}} in the source" href="https://github.com/adobe-webplatform/savage/blob/master/src/svg.js#{{=item[0].line}}">&#x27ad;</a></h3>
<h3 class="{{=item[0].clas}}">{{=item[0].name}}<a href="#{{=item[0].title}}" title="Link to this section" class="dr-hash">&#x2693;</a><a class="dr-sourceline" title="Go to line {{=item[0].line}} in the source" href="{{=item[0].sourceFileName}}#L{{=item[0].line}}">&#x27ad;</a></h3>
</header>
<section>
<div class="extra" id="{{=item[0].title}}-extra"></div>
Expand Down