Skip to content

Commit 6d9e484

Browse files
committed
Merge branch 'master' into members
2 parents d8f31fd + 4612975 commit 6d9e484

25 files changed

+579
-469
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ packages
1010
.packages
1111
.settings/
1212
.DS_Store
13+
*.iml
1314

1415
pub.dartlang.org/
1516

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: dart
22
sudo: false
3-
dart:
3+
dart:
44
- dev
5-
- stable
5+
# - stable
66
env:
77
- GEN_SDK_DOCS=true
88
- GEN_SDK_DOCS=false

appveyor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ install:
99
- set PATH=%PATH%;%APPDATA%\Pub\Cache\bin
1010
- pub get
1111

12+
# this doesn't seem to be working
1213
build: off
1314

15+
branches:
16+
only:
17+
- disable_builds_for_now
18+
1419
test_script:
1520
- pub run grinder buildbot

lib/dartdoc.dart

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import 'package:analyzer/src/generated/source_io.dart';
1919

2020
import 'generator.dart';
2121
import 'resource_loader.dart' as loader;
22-
import 'src/html_generator.dart';
22+
import 'src/html_generator.dart' show dartdocVersion, HtmlGenerator;
2323
import 'src/io_utils.dart';
2424
import 'src/model.dart';
2525
import 'src/model_utils.dart';
@@ -37,6 +37,7 @@ final String defaultOutDir = 'doc${Platform.pathSeparator}api';
3737
/// Initialize and setup the generators.
3838
List<Generator> initGenerators(
3939
String url, String headerFilePath, String footerFilePath) {
40+
dartdocVersion = version;
4041
return [
4142
new HtmlGenerator(url, header: headerFilePath, footer: footerFilePath)
4243
];
@@ -57,8 +58,15 @@ class DartDoc {
5758

5859
Stopwatch _stopwatch;
5960

60-
DartDoc(this.rootDir, this.excludes, this.sdkDir, this.generators,
61-
this.outputDir, this.packageRootDir, this.packageMeta, this.urlMappings,
61+
DartDoc(
62+
this.rootDir,
63+
this.excludes,
64+
this.sdkDir,
65+
this.generators,
66+
this.outputDir,
67+
this.packageRootDir,
68+
this.packageMeta,
69+
this.urlMappings,
6270
this.includes);
6371

6472
/// Generate DartDoc documentation.
@@ -151,7 +159,7 @@ class DartDoc {
151159
if (name.startsWith(Platform.pathSeparator)) name = name.substring(1);
152160
}
153161
print('parsing ${name}...');
154-
Source source = new FileBasedSource.con1(new JavaFile(filePath));
162+
Source source = new FileBasedSource(new JavaFile(filePath));
155163
sources.add(source);
156164
if (context.computeKindOf(source) == SourceKind.LIBRARY) {
157165
LibraryElement library = context.computeLibraryElement(source);
@@ -178,8 +186,8 @@ class DartDoc {
178186
}).where((_Error error) => error.isError).toList()..sort();
179187

180188
double seconds = _stopwatch.elapsedMilliseconds / 1000.0;
181-
print(
182-
"Parsed ${libraries.length} " "file${libraries.length == 1 ? '' : 's'} in "
189+
print("Parsed ${libraries.length} "
190+
"file${libraries.length == 1 ? '' : 's'} in "
183191
"${seconds.toStringAsFixed(1)} seconds.\n");
184192

185193
if (errors.isNotEmpty) {

lib/markdown_processor.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class Documentation {
6969
String tempHtml = renderMarkdownToHtml(raw, element);
7070
_asHtmlDocument = parse(tempHtml);
7171
_asHtmlDocument.querySelectorAll('script').forEach((s) => s.remove());
72-
_asHtmlDocument.querySelectorAll('code').forEach((e) {
72+
_asHtmlDocument.querySelectorAll('pre').forEach((e) {
7373
e.classes.addAll(['prettyprint', 'lang-dart']);
7474
});
7575
_asHtml = _asHtmlDocument.body.innerHtml;
@@ -98,9 +98,6 @@ class _InlineCodeSyntax extends md.InlineSyntax {
9898
@override
9999
bool onMatch(md.InlineParser parser, Match match) {
100100
var element = new md.Element.text('code', htmlEscape(match[1]));
101-
var c = element.attributes.putIfAbsent("class", () => "");
102-
c = (c.isEmpty ? "" : " ") + "prettyprint";
103-
element.attributes["class"] = c;
104101
parser.addNode(element);
105102
return true;
106103
}
@@ -124,7 +121,9 @@ NodeList<CommentReference> _getCommentRefs(ModelElement modelElement) {
124121
if (modelElement.element.node is AnnotatedNode) {
125122
if ((modelElement.element.node as AnnotatedNode).documentationComment !=
126123
null) {
127-
return (modelElement.element.node as AnnotatedNode).documentationComment.references;
124+
return (modelElement.element.node as AnnotatedNode)
125+
.documentationComment
126+
.references;
128127
}
129128
} else if (modelElement.element is LibraryElement) {
130129
// handle anonymous libraries

lib/resource_loader.dart

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
// TODO: Consider making this a stand-alone package, if useful.
6-
75
/// Make it possible to load resources, independent of how the Dart app is run.
86
///
97
/// Future<String> getTemplateFile(String templatePath) {
@@ -14,7 +12,7 @@ library dartdoc.resource_loader;
1412

1513
import 'dart:async' show Future;
1614
import 'dart:io' show Platform, File, Directory;
17-
import 'dart:typed_data';
15+
import 'dart:typed_data' show Uint8List;
1816

1917
import 'package:http/http.dart' as http;
2018
import 'package:path/path.dart' as p;
@@ -24,20 +22,27 @@ import 'package:pub_cache/pub_cache.dart';
2422
String packageRootPath;
2523

2624
/// Loads a `package:` resource as a String.
27-
Future<String> loadAsString(String path) async {
25+
Future<String> loadAsString(String path) {
2826
if (!path.startsWith('package:')) {
2927
throw new ArgumentError('path must begin with package:');
3028
}
31-
Uint8List bytes = await _doLoad(path);
32-
return new String.fromCharCodes(bytes);
29+
return new Resource(path).readAsString().catchError((_) async {
30+
// TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed.
31+
var bytes = await _doLoad(path);
32+
return new String.fromCharCodes(bytes);
33+
});
3334
}
3435

35-
/// Loads a `package:` resource as an [Uint8List].
36-
Future<Uint8List> loadAsBytes(String path) {
36+
/// Loads a `package:` resource as an [List<int>].
37+
Future<List<int>> loadAsBytes(String path) {
3738
if (!path.startsWith('package:')) {
3839
throw new ArgumentError('path must begin with package:');
3940
}
40-
return _doLoad(path);
41+
42+
return new Resource(path).readAsBytes().catchError((_) {
43+
// TODO: Remove once https://github.com/dart-lang/pub/issues/22 is fixed.
44+
return _doLoad(path);
45+
});
4146
}
4247

4348
/// Determine how to do the load. HTTP? Snapshotted? From source?

lib/resources/styles.css

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ a, a:hover {
122122
color: #1976D2;
123123
}
124124

125-
pre {
125+
pre.prettyprint {
126126
font-family: 'Source Code Pro', monospace;
127127
color: black;
128128
border-radius: 4px;
@@ -146,11 +146,8 @@ pre code {
146146
code {
147147
font-family: 'Source Code Pro', monospace;
148148
/* overriding bootstrap */
149-
font-size: 15px;
150149
color: inherit;
151-
border-radius: 0;
152-
padding: 0;
153-
background-color: inherit;
150+
background-color: #f7f7f7;
154151
}
155152

156153
@media(max-width: 768px) {
@@ -337,7 +334,7 @@ footer .container-fluid {
337334
}
338335

339336
.gt-separated li:before {
340-
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='#FFFFFF' d='M6.7,4L5.7,4.9L8.8,8l-3.1,3.1L6.7,12l4-4L6.7,4z'/></svg>");
337+
background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='#DDDDDD' d='M6.7,4L5.7,4.9L8.8,8l-3.1,3.1L6.7,12l4-4L6.7,4z'/></svg>");
341338
background-position: center;
342339
content: "\00a0";
343340
margin: 0 6px 0 4px;
@@ -516,7 +513,8 @@ span.top-level-variable-type {
516513
}
517514

518515
.sidebar ol li.section-title {
519-
font-size: 12px;
516+
font-size: 13px;
517+
color: #B6B6B6;
520518
text-transform: uppercase;
521519
line-height: 20px;
522520
margin-top: 24px;

0 commit comments

Comments
 (0)