jsdoc: render menu and move resources into static.

This commit is contained in:
Jonathan Puckey 2011-05-28 19:31:41 +02:00
parent 3bb4e4a0c7
commit de9378f5c6
20 changed files with 103 additions and 235 deletions

View file

@ -82,7 +82,7 @@ Link.symbolNameToLinkName = function(symbol) {
var linker = "",
ns = "";
if (symbol.isStatic) linker = ".";
if (symbol.isStatic) linker = "-";
else if (symbol.isInner) linker = "-";
if (symbol.isEvent && !/^event:/.test(symbol.name)) {
@ -137,7 +137,7 @@ Link.prototype._makeSymbolLink = function(alias, parameters) {
// it's a symbol in another file
if (!linkTo.is("CONSTRUCTOR") && !linkTo.isNamespace) { // it's a method or property
linkPath= (Link.filemap) ? Link.filemap[linkTo.memberOf] :
escape(linkTo.memberOf) || "_global_";
escape(linkTo.memberOf) || "global";
linkPath += publish.conf.ext + "#" + Link.symbolNameToLinkName(linkTo).toLowerCase();
if (parameters) {
linkPath += '-' + parameters.replace(/[()]+/g, '').split(', ').join('-').toLowerCase();

View file

@ -0,0 +1,10 @@
JSDOC.PluginManager.registerPlugin(
"JSDOC.ignore",
{
onSymbol: function(symbol) {
if (symbol.comment.getTag('ignore').length) {
symbol.ignore = true;
}
}
}
);

View file

@ -0,0 +1,14 @@
var classLayout = {
'Paper.js': ['global'],
'Basic Types': ['Point', 'Size', 'Rectangle', 'Matrix'],
'Items': ['Item', 'Layer', 'Group', 'Raster', 'PlacedSymbol'],
'Paths': ['Path', 'CompoundPath', 'Segment', 'Curve', 'PathStyle', 'ruler',
'CurveLocation'],
'Tools': ['Tool', 'ToolEvent', 'Key', 'KeyEvent'],
'Projects': ['Project', 'View', 'Symbol'],
'Colors': ['Color', 'RGBColor', 'GrayColor', 'HSBColor'],
'Gradients': ['GradientColor', 'Gradient', 'GradientStop'],
'Typography': ['TextItem', 'PointText', {
'Style': ['CharacterStyle', 'ParagraphStyle']
}]
};

View file

@ -63,13 +63,13 @@ var Helpers = {
function publish(symbolSet) {
publish.conf = { // trailing slash expected for dirs
ext: '.html',
outDir: JSDOC.opt.d || SYS.pwd + '../out/jsdoc/',
outDir: JSDOC.opt.d || SYS.pwd + '../out/jsdoc/',
templateDir: JSDOC.opt.t || SYS.pwd + '../templates/jsdoc/',
resourcesDir: (JSDOC.opt.t || SYS.pwd + '../templates/jsdoc/') + 'resources/',
symbolsDir: 'symbols/',
srcDir: 'symbols/src/'
staticDir: (JSDOC.opt.t || SYS.pwd + '../templates/jsdoc/') + 'static/',
symbolsDir: 'symbols/',
srcDir: 'symbols/src/'
};
publish.conf.packagesDir = publish.conf.outDir + 'packages/';
var templatesDir = publish.conf.templateDir + 'templates/';
publish.templates = {
_class: 'class.tmpl',
@ -81,7 +81,7 @@ function publish(symbolSet) {
constructor: 'constructor.tmpl',
html: 'html.tmpl',
allClasses: 'allClasses.tmpl',
classesIndex: 'index.tmpl'
menu: 'packages.tmpl'
};
for (var i in publish.templates) {
@ -91,8 +91,8 @@ function publish(symbolSet) {
// Copy over the static files
copyDirectory(
new java.io.File(publish.conf.resourcesDir),
new java.io.File(publish.conf.outDir + 'resources/')
new java.io.File(publish.conf.staticDir),
new java.io.File(publish.conf.outDir)
);
// used to allow Link to check the details of things being linked to
@ -143,15 +143,53 @@ function publish(symbolSet) {
})
var name = ((JSDOC.opt.u)? Link.filemap[symbol.alias] : symbol.alias)
+ publish.conf.ext;
IO.saveFile(publish.conf.outDir + 'symbols/', name, html);
IO.saveFile(publish.conf.packagesDir, name, html);
}
// regenerate the index with different relative links, used in the index pages
Link.base = '';
publish.conf.classesIndex = publish.templates.allClasses.process(classes);
publishMenu();
}
function publishMenu() {
load(JSDOC.opt.t + 'classLayout.js');
function parseClassNames(classNames) {
var out = '';
for (var i = 0, l = classNames.length; i < l; i++) {
if (typeof classNames[i] == 'string') {
var name = classNames[i];
out += (name == 'ruler') ? getRuler() : getLink(name);
} else {
for (var j in classNames[i]) {
out += getHeading(j);
out += parseClassNames(classNames[i][j]);
}
}
}
return out;
}
function getLink(name) {
return '<li><a href="' + name + '.html">' + name + '</a></li>';
}
var classesIndex = publish.templates.classesIndex.process(classes);
IO.saveFile(publish.conf.outDir, 'index' + publish.conf.ext, classesIndex);
function getRuler() {
return '<li><hr /></li>';
}
function getHeading(title) {
return '<li><h3>' + title + '</h3></li>';
}
var first = true,
out = '<ul class="package-classes">';
for (var i in classLayout) {
out += '<li' + (first ? ' class="first">' : '>');
out += '<h2>' + i + '</h2>';
out += parseClassNames(classLayout[i]);
out += '</li>';
first = false;
}
out += '</ul';
var classesIndex = publish.templates.menu.process(out);
IO.saveFile(publish.conf.packagesDir, 'packages.html', classesIndex);
}
/** Make a symbol sorter by some attribute. */

View file

@ -1,162 +0,0 @@
/* default.css */
body
{
font: 12px "Lucida Grande", Tahoma, Arial, Helvetica, sans-serif;
width: 800px;
}
.header
{
clear: both;
background-color: #ccc;
padding: 8px;
}
h1
{
font-size: 150%;
font-weight: bold;
padding: 0;
margin: 1em 0 0 .3em;
}
hr
{
border: none 0;
border-top: 1px solid #7F8FB1;
height: 1px;
}
pre.code
{
display: block;
padding: 8px;
border: 1px dashed #ccc;
}
#index
{
margin-top: 24px;
float: left;
width: 160px;
position: absolute;
left: 8px;
background-color: #F3F3F3;
padding: 8px;
}
#content
{
margin-left: 190px;
width: 600px;
}
.classList
{
list-style-type: none;
padding: 0;
margin: 0 0 0 8px;
font-family: arial, sans-serif;
font-size: 1em;
overflow: auto;
}
.classList li
{
padding: 0;
margin: 0 0 8px 0;
}
.summaryTable { width: 100%; }
h1.classTitle
{
font-size:170%;
line-height:130%;
}
h2 { font-size: 110%; }
caption, div.sectionTitle
{
background-color: #7F8FB1;
color: #fff;
font-size:130%;
text-align: left;
padding: 2px 6px 2px 6px;
border: 1px #7F8FB1 solid;
}
div.sectionTitle { margin-bottom: 8px; }
.summaryTable thead { display: none; }
.summaryTable td
{
vertical-align: top;
padding: 4px;
border-bottom: 1px #7F8FB1 solid;
border-right: 1px #7F8FB1 solid;
}
/*col#summaryAttributes {}*/
.summaryTable td.attributes
{
border-left: 1px #7F8FB1 solid;
width: 140px;
text-align: right;
}
td.attributes, .fixedFont
{
line-height: 15px;
color: #002EBE;
font-family: "Courier New",Courier,monospace;
font-size: 13px;
}
.summaryTable td.nameDescription
{
text-align: left;
font-size: 13px;
line-height: 15px;
}
.summaryTable td.nameDescription, .description
{
line-height: 15px;
padding: 4px;
padding-left: 4px;
}
.summaryTable { margin-bottom: 8px; }
ul.inheritsList
{
list-style: square;
margin-left: 20px;
padding-left: 0;
}
.detailList {
margin-left: 20px;
line-height: 15px;
}
.detailList dt { margin-left: 20px; }
.detailList .heading
{
font-weight: bold;
padding-bottom: 6px;
margin-left: 0;
}
.light, td.attributes, .light a:link, .light a:visited
{
color: #777;
font-style: italic;
}
.fineprint
{
text-align: right;
font-size: 10px;
}

View file

@ -1,2 +0,0 @@
<div id="header">
</div>

View file

@ -1,19 +1,12 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Generated Javascript Documentation</title>
<title>
Scriptographer 2.9 API
</title>
</head>
<frameset cols="20%,80%">
<frame src="allclasses-frame.html" name="packageFrame" />
<frame src="splash.html" name="classFrame" />
<noframes>
<body>
<p>
This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client.
</p>
</body>
</noframes>
<frameset cols="230,*">
<frame src="packages/packages.html" name="packageListFrame" title="All Packages">
<frame src="about:blank" name="classFrame" title="Class and interface descriptions">
</frameset>
</html>
</html>

View file

@ -1,39 +0,0 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset={+IO.encoding+}" />
<title>JsDoc Reference - Index</title>
<meta name="generator" content="JsDoc Toolkit" />
<style type="text/css">
{+include("static/default.css")+}
</style>
</head>
<body>
{+include("static/header.html")+}
<div id="index">
{+publish.classesIndex+}
</div>
<div id="content">
<h1 class="classTitle">Class Index</h1>
<for each="thisClass" in="data">
<div>
<h2>{+(new Link().toSymbol(thisClass.alias))+}</h2>
{+processInlineTags(thisClass.classDesc)+}
</div>
<hr />
</for>
</div>
<div class="fineprint" style="clear:both">
<if test="JSDOC.opt.D.copyright">&copy;{+JSDOC.opt.D.copyright+}<br /></if>
Documentation generated by <a href="http://code.google.com/p/jsdoc-toolkit/" target="_blankt">JsDoc Toolkit</a> {+JSDOC.VERSION+} on {+new Date()+}
</div>
</body>
</html>

View file

@ -0,0 +1,16 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Paper.js</title>
<base target="classFrame">
<link rel="stylesheet" href="../resources/css/reference.css" type="text/css">
<link rel="stylesheet" href="../resources/css/style.css" type="text/css">
<script src="../resources/js/bootstrap.js" type="text/javascript"></script>
<script src="../resources/js/reference.js" type="text/javascript"></script>
</head>
<body class="reference">
<div class="reference-packages">
<h1>Paper.js</h1>
{+ data +}
</body>
</html>