Hook up favicon, link to main page, and fix process bug.

Review URL: http://codereview.chromium.org//9020028

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2735 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
rnystrom@google.com 2011-12-21 23:35:24 +00:00
parent 884228569f
commit e66f5a3e6c
6 changed files with 88 additions and 322 deletions

View file

@ -20,7 +20,6 @@ void main() {
parseOptions('../../frog', [] /* args */, files);
initializeWorld(files);
final apidoc = new Apidoc();
apidoc.mainTitle = 'Dart API Reference';
HtmlDiff.initialize();
@ -32,6 +31,48 @@ void main() {
}
class Apidoc extends doc.Dartdoc {
Apidoc() {
mainTitle = 'Dart API Reference';
mainUrl = 'http://dartlang.org';
final note = 'http://code.google.com/policies.html#restrictions';
final cca = 'http://creativecommons.org/licenses/by/3.0/';
final bsd = 'http://code.google.com/google_bsd_license.html';
final tos = 'http://www.dartlang.org/tos.html';
final privacy = 'http://www.google.com/intl/en/privacy/privacy-policy.html';
footerText =
'''
<p>Except as otherwise <a href="$note">noted</a>, the content of this
page is licensed under the <a href="$cca">Creative Commons Attribution
3.0 License</a>, and code samples are licensed under the
<a href="$bsd">BSD License</a>.</p>
<p><a href="$tos">Terms of Service</a> |
<a href="$privacy">Privacy Policy</a></p>
''';
}
void writeHeadContents(String title) {
super.writeHeadContents(title);
// Add the analytics code.
doc.writeln(
'''
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-26406144-4']);
_gaq.push(['_setDomainName', 'dartlang.org']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
''');
}
getTypeComment(Type type) {
return _mergeComments(super.getTypeComment(type), getTypeDoc(type));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

View file

@ -1,310 +0,0 @@
/* Reset */
body, h1, h2, h3, h4, li, ol, p, pre, section, ul {
margin: 0;
padding: 0;
}
body {
font-family: Georgia, serif;
background: #e8e8e8;
color: #333;
background-image: url('button-textured.png');
background-repeat: repeat;
}
h1 {
font: 700 22px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
margin: 0 0 22px 0;
}
h2 {
font: 400 28px/44px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
margin: 22px 0;
}
h3 {
font: 600 14px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
color: #999;
margin: 22px 0 0 0;
}
h4 {
font: 600 16px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
}
p {
font-size: 16px;
line-height: 22px;
margin: 22px 0;
}
strong {
font-weight: 700;
}
pre, code {
font: 14px/22px Menlo, Monaco, Consolas, Courier, monospace;
color: hsl(220, 20%, 30%);
background: hsl(220, 20%, 95%);
margin: 22px 0;
padding: 0 4px;
border-radius: 4px;
overflow: hidden;
}
a {
color: #15c;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
a:visited {
color: #15c;
}
li {
font-size: 16px;
line-height: 22px;
}
ol, ul {
padding-left: 22px;
}
hr {
border: none;
height: 1px;
background: #ccc;
margin: 22px 0 21px 0;
}
hr + h2 {
margin-top: 21px; /* To compensate for the thickness of the hr. */
}
.page {
max-width: 1000px; /* 43 x 22px */
background: #fff;
margin: 0 auto 22px auto;
border-top: none;
box-shadow: 0 0 50px #888;
}
.nav {
float: left;
width: 263px; /* 12 x 22px - 1 for border */
padding: 22px 22px;
overflow: hidden;
background: #f4f4f4;
border-right: solid 1px #ccc;
}
.nav h2 {
font: 400 16px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
margin: 0 -21px;
padding: 11px 22px;
/* Using http://www.colorzilla.com/gradient-editor/ */
background: -moz-linear-gradient(top, hsla(0,0%,0%,0.05) 0%, hsla(0,0%,0%,0) 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,hsla(0,0%,0%,0.05)), color-stop(100%,hsla(0,0%,0%,0)));
background: -webkit-linear-gradient(top, hsla(0,0%,0%,0.05) 0%,hsla(0,0%,0%,0) 100%);
background: -o-linear-gradient(top, hsla(0,0%,0%,0.05) 0%,hsla(0,0%,0%,0) 100%);
background: -ms-linear-gradient(top, hsla(0,0%,0%,0.05) 0%,hsla(0,0%,0%,0) 100%);
background: linear-gradient(top, hsla(0,0%,0%,0.05) 0%,hsla(0,0%,0%,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0d000000', endColorstr='#00000000',GradientType=0);
}
.nav li {
font: 600 13px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
list-style-type: none;
white-space: nowrap;
}
.nav ul {
margin: 0 0 22px 0;
padding: 0;
}
.icon-class,
.icon-exception,
.icon-interface {
display: inline-block;
width: 14px;
height: 14px;
margin: 5px 10px 0 2px;
vertical-align: top;
}
.icon-class { background: url('class.png'); }
.icon-exception { background: url('exception.png'); }
.icon-interface { background: url('interface.png'); }
.icon-library {
background: url('library.png');
width: 16px;
height: 14px;
display: inline-block;
margin: 4px 8px 0 0;
vertical-align: top;
}
.content {
margin-left: 308px; /* 14 x 22px */
padding: 22px 22px;
}
.footer {
clear: both;
}
.method .doc,
.field .doc {
padding-left: 44px;
}
.param {
font: 600 14px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
}
.crossref {
font: 600 15px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
}
.doc h1 {
font: 700 17px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
color: #666;
}
.doc h2 {
font: 600 16px/22px 'Open Sans', 'Lucida Sans Unicode',
'Lucida Grande', sans-serif;
color: #666;
}
/* Highlight members on hover so you can see which docs are for which member. */
.method:hover,
.field:hover {
margin: 0 -22px;
border: solid 4px hsl(40, 100%, 85%);
padding: 0 18px;
border-top: none;
border-bottom: none;
}
/* Only show the "code" link for the highlighted member. */
.show-code {
float: right;
font: 600 11px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
padding-left: 6px; /* In case it gets too close to the member. */
}
.method:hover .show-code,
.field:hover .show-code {
display: inline;
}
/* Only show permalinks when hovered over. */
.anchor-link {
display: none;
}
h2:hover > .anchor-link,
h4:hover > .anchor-link {
display: inline;
}
/* Only show code when expanded. */
pre.source {
display: none;
}
pre.source.expanded {
display: block;
}
/* Links that don't cause a page refresh. */
.anchor-link, .anchor-link:visited,
.show-code, .show-code:visited {
color: hsl(40, 100%, 40%);
display: none;
cursor: pointer;
}
.anchor-link:hover,
.show-code:hover {
color: hsl(40, 100%, 60%);
}
/* Syntax highlighting. */
/* Note: these correspond to the constants in classify.dart. */
pre.source .e { color: hsl( 0, 100%, 70%); } /* Error */
pre.source .c { color: hsl(220, 20%, 65%); } /* Comment */
pre.source .i { color: hsl(220, 20%, 20%); } /* Identifier */
pre.source .k { color: hsl(220, 100%, 50%); } /* Keyword */
pre.source .p { color: hsl(220, 20%, 50%); } /* Punctuation */
pre.source .o { color: hsl(220, 40%, 50%); } /* Operator */
pre.source .s { color: hsl( 40, 90%, 40%); } /* String */
pre.source .n { color: hsl( 30, 70%, 50%); } /* Number */
pre.source .t { color: hsl(180, 40%, 40%); } /* Type Name */
pre.source .r { color: hsl(200, 100%, 50%); } /* Special Identifier */
pre.source .a { color: hsl(220, 100%, 45%); } /* Arrow */
/* Interpolated expressions within strings. */
pre.source .si {
background: hsl(40, 100%, 90%);
}
pre.source .s.si { background: hsl(40, 80%, 95%); }
pre.source .i.si { color: hsl(40, 30%, 30%); }
pre.source .p.si { color: hsl(40, 60%, 40%); }
/* Enable these to debug the grid: */
/*
body {
background: -webkit-linear-gradient(top, #eee 0, #fff 10%, #fff 90%, #eee 100%);
background-size: 22px 22px;
background-repeat: repeat;
}
.page {
background: none;
}
h1 {
border-left: solid 4px green;
}
h2 {
border-left: solid 4px blue;
}
h3 {
border-left: solid 4px red;
}
h4 {
border-left: solid 4px orange;
}
p {
border-left: solid 4px purple;
}
section {
border-left: solid 4px gray;
}
*/

View file

@ -18,6 +18,7 @@
#import('../../frog/lang.dart');
#import('../../frog/file_system.dart');
#import('../../frog/file_system_node.dart');
#import('../../frog/lib/node/node.dart');
#import('markdown.dart', prefix: 'md');
#source('classify.dart');
@ -47,7 +48,7 @@ void main() {
}
}
FileSystem files = new NodeFileSystem();
final files = new NodeFileSystem();
parseOptions('../../frog', [] /* args */, files);
initializeWorld(files);
@ -72,6 +73,15 @@ class Dartdoc {
*/
String mainTitle = 'Dart Documentation';
/**
* The URL that the Dart logo links to. Defaults "index.html", the main
* page for the generated docs, but can be anything.
*/
String mainUrl = 'index.html';
/** Set this to add footer text to each generated page. */
String footerText = '';
CommentMap _comments;
/** The library that we're currently generating docs for. */
@ -162,17 +172,15 @@ class Dartdoc {
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>$title</title>
<link rel="stylesheet" type="text/css"
href="${relativePath('styles.css')}" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
<script src="${relativePath('interact.js')}"></script>
''');
writeHeadContents(title);
write(
'''
</head>
<body>
<div class="page">
<div class="header">
${a('index.html', '<div class="logo"></div>')}
${a(mainUrl, '<div class="logo"></div>')}
${a('index.html', mainTitle)}
''');
@ -190,11 +198,26 @@ class Dartdoc {
writeln('<div class="content">');
}
writeHeadContents(String title) {
writeln(
'''
<meta charset="utf-8">
<title>$title</title>
<link rel="stylesheet" type="text/css"
href="${relativePath('styles.css')}" />
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="${relativePath('favicon.ico')}" />
<script src="${relativePath('interact.js')}"></script>
''');
}
writeFooter() {
writeln(
'''
</div>
<div class="footer"</div>
<div class="clear"></div>
</div>
<div class="footer">$footerText</div>
</body></html>
''');
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -180,14 +180,26 @@ hr + h2 {
}
.content {
margin-left: 308px; /* 14 x 22px */
margin-left: 308px; /* 14 x 22 */
padding: 22px 22px;
}
.footer {
.clear {
clear: both;
}
.footer {
max-width: 956px; /* 1000 - 22 - 22 */
text-align: center;
margin: 22px auto;
color: #888;
}
.footer p {
font: 400 13px/22px 'Open Sans', 'Lucida Sans Unicode', 'Lucida Grande',
sans-serif;
}
.method .doc,
.field .doc {
padding-left: 44px;