Skip to content

Commit 2064f7d

Browse files
committed
Merge branch 'master' of github.com:dart-lang/dartdoc into sl-find-as-you-type
2 parents 9e92254 + 6ca3b28 commit 2064f7d

File tree

4 files changed

+38
-26
lines changed

4 files changed

+38
-26
lines changed

lib/markdown_processor.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,28 +110,29 @@ NodeList<CommentReference> _getCommentRefs(ModelElement modelElement) {
110110
if (modelElement.documentation == null && modelElement.canOverride()) {
111111
var melement = modelElement.overriddenElement;
112112
if (melement != null &&
113-
melement.element.node != null &&
114-
melement.element.node is AnnotatedNode) {
115-
var docComment =
116-
(melement.element.node as AnnotatedNode).documentationComment;
113+
melement.element.computeNode() != null &&
114+
melement.element.computeNode() is AnnotatedNode) {
115+
var docComment = (melement.element.computeNode() as AnnotatedNode)
116+
.documentationComment;
117117
if (docComment != null) return docComment.references;
118118
return null;
119119
}
120120
}
121-
if (modelElement.element.node is AnnotatedNode) {
122-
if ((modelElement.element.node as AnnotatedNode).documentationComment !=
121+
if (modelElement.element.computeNode() is AnnotatedNode) {
122+
if ((modelElement.element.computeNode() as AnnotatedNode)
123+
.documentationComment !=
123124
null) {
124-
return (modelElement.element.node as AnnotatedNode)
125+
return (modelElement.element.computeNode() as AnnotatedNode)
125126
.documentationComment
126127
.references;
127128
}
128129
} else if (modelElement.element is LibraryElement) {
129130
// handle anonymous libraries
130-
if (modelElement.element.node == null ||
131-
modelElement.element.node.parent == null) {
131+
if (modelElement.element.computeNode() == null ||
132+
modelElement.element.computeNode().parent == null) {
132133
return null;
133134
}
134-
var node = modelElement.element.node.parent.parent;
135+
var node = modelElement.element.computeNode().parent.parent;
135136
if (node is AnnotatedNode) {
136137
if ((node as AnnotatedNode).documentationComment != null) {
137138
return (node as AnnotatedNode).documentationComment.references;

lib/resources/styles.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@ dd.callable, dd.constant, dd.property {
214214

215215
dd p {
216216
margin-top: 4px;
217+
white-space: nowrap;
218+
overflow-x: hidden;
219+
text-overflow: ellipsis;
217220
}
218221

219222
section.summary h2 {
@@ -513,6 +516,7 @@ span.top-level-variable-type {
513516
padding: 16px;
514517
}
515518

519+
.sidebar h5,
516520
.sidebar ol li {
517521
text-overflow: ellipsis;
518522
overflow: hidden;
@@ -563,7 +567,7 @@ button {
563567
}
564568

565569
#overlay-under-drawer.active {
566-
opacity: 0.7;
570+
opacity: 0.4;
567571
height: 100%;
568572
z-index: 1999;
569573
position: fixed;

lib/src/model.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,11 @@ abstract class ModelElement implements Comparable, Nameable {
172172
List<String> get annotations {
173173
// Check https://code.google.com/p/dart/issues/detail?id=23181
174174
// If that is fixed, this code might get a lot easier
175-
if (element.node != null && element.node is AnnotatedNode) {
176-
return (element.node as AnnotatedNode).metadata.map((Annotation a) {
175+
if (element.computeNode() != null &&
176+
element.computeNode() is AnnotatedNode) {
177+
return (element.computeNode() as AnnotatedNode)
178+
.metadata
179+
.map((Annotation a) {
177180
var annotationString = a.toSource().substring(1); // remove the @
178181
var e = a.element;
179182
if (e != null && (e is ConstructorElement)) {
@@ -1277,7 +1280,7 @@ class Enum extends Class {
12771280
abstract class SourceCodeMixin {
12781281
String get sourceCode {
12791282
String contents = element.source.contents.data;
1280-
var node = element.node; // TODO: computeNode once we go to 0.25.2
1283+
var node = element.computeNode(); // TODO: computeNode once we go to 0.25.2
12811284
// find the start of the line, so that we can line up all the indents
12821285
int i = node.offset;
12831286
while (i > 0) {
@@ -1423,8 +1426,8 @@ class Field extends ModelElement implements EnclosedElement {
14231426
String get constantValue {
14241427
if (_constantValue != null) return _constantValue;
14251428

1426-
if (_field.node == null) return null;
1427-
var v = _field.node.toSource();
1429+
if (_field.computeNode() == null) return null;
1430+
var v = _field.computeNode().toSource();
14281431
if (v == null) return null;
14291432
var string = v.substring(v.indexOf('=') + 1, v.length).trim();
14301433
_constantValue = string.replaceAll(modelType.name, modelType.linkedName);
@@ -1700,7 +1703,9 @@ class TopLevelVariable extends ModelElement implements EnclosedElement {
17001703
}
17011704

17021705
String get constantValue {
1703-
var v = (_variable as ConstTopLevelVariableElementImpl).node.toSource();
1706+
var v = (_variable as ConstTopLevelVariableElementImpl)
1707+
.computeNode()
1708+
.toSource();
17041709
if (v == null) return '';
17051710
var string = v.substring(v.indexOf('=') + 1, v.length).trim();
17061711
return string.replaceAll(modelType.name, modelType.linkedName);

lib/templates/index.html

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
{{>head}}
22

3+
<div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
4+
<h5>{{self.name}}</h5>
5+
6+
<ol>
7+
<li class="section-title"><a href="{{package.href}}#libraries">Libraries</a></li>
8+
{{#package.libraries}}
9+
<li><a href="{{href}}">{{name}}</a></li>
10+
{{/package.libraries}}
11+
</ol>
12+
</div>
13+
314
<div class="col-xs-12 col-sm-9 col-md-8 main-content">
415

516
{{#package}}
@@ -25,15 +36,6 @@ <h2>Libraries</h2>
2536

2637
<div class="col-xs-6 col-sm-6 col-md-2 sidebar sidebar-offcanvas-right">
2738

28-
<h5>{{self.name}}</h5>
29-
30-
<ol>
31-
<li class="section-title"><a href="{{package.href}}#libraries">Libraries</a></li>
32-
{{#package.libraries}}
33-
<li><a href="{{href}}">{{name}}</a></li>
34-
{{/package.libraries}}
35-
</ol>
36-
3739
</div><!--/.sidebar-offcanvas-right-->
3840

3941
{{>footer}}

0 commit comments

Comments
 (0)