Skip to content

Commit b2f61f7

Browse files
authored
Merge pull request #1181 from dart-lang/show_entire_first_line_text
show the entire text for the first line of dartdoc
2 parents 8f83cff + 098ce15 commit b2f61f7

11 files changed

+13
-37
lines changed

lib/resources/styles.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ dd.callable, dd.constant, dd.property {
255255
}
256256

257257
dd p {
258-
white-space: nowrap;
259258
overflow-x: hidden;
260259
text-overflow: ellipsis;
261260
margin-bottom: 0;

lib/src/html/templates.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import 'resource_loader.dart' as loader;
1010
typedef String TemplateRenderer(context,
1111
{bool assumeNullNonExistingProperty, bool errorOnMissingProperty});
1212

13-
// TODO: if we can ever enumerate the contents of a package, we
14-
// won't need this.
1513
const _partials = const <String>[
1614
'callable',
1715
'callable_multiline',
@@ -26,7 +24,6 @@ const _partials = const <String>[
2624
'sidebar_for_class',
2725
'source_code',
2826
'sidebar_for_library',
29-
'has_more_docs',
3027
'accessor_getter',
3128
'accessor_setter'
3229
];

lib/src/markdown_processor.dart

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ class Documentation {
163163
final String raw;
164164
final String asHtml;
165165
final String asOneLiner;
166-
final bool hasMoreThanOneLineDocs;
167166

168167
factory Documentation(String markdown) {
169168
String tempHtml = _renderMarkdownToHtml(markdown);
@@ -175,8 +174,7 @@ class Documentation {
175174
return new Documentation._internal(element.documentation, tempHtml);
176175
}
177176

178-
Documentation._(
179-
this.raw, this.asHtml, this.hasMoreThanOneLineDocs, this.asOneLiner);
177+
Documentation._(this.raw, this.asHtml, this.asOneLiner);
180178

181179
factory Documentation._internal(String markdown, String rawHtml) {
182180
var asHtmlDocument = parse(rawHtml);
@@ -206,18 +204,14 @@ class Documentation {
206204
}
207205
var asHtml = asHtmlDocument.body.innerHtml;
208206

209-
// Fixes issue with line ending differences between mac and windows, affecting tests
207+
// Fixes issue with line ending differences between mac and windows.
210208
if (asHtml != null) asHtml = asHtml.trim();
211209

212-
var asOneLiner = '';
213-
var moreThanOneLineDoc = asHtmlDocument.body.children.length > 1;
210+
var asOneLiner = asHtmlDocument.body.children.isEmpty
211+
? ''
212+
: asHtmlDocument.body.children.first.innerHtml;
214213

215-
if (asHtmlDocument.body.children.isNotEmpty) {
216-
asOneLiner = asHtmlDocument.body.children.first.innerHtml;
217-
}
218-
219-
return new Documentation._(
220-
markdown, asHtml, moreThanOneLineDoc, asOneLiner);
214+
return new Documentation._(markdown, asHtml, asOneLiner);
221215
}
222216
}
223217

lib/src/model.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,6 @@ abstract class Documentable {
659659
String get documentation;
660660
String get documentationAsHtml;
661661
bool get hasDocumentation;
662-
bool get hasMoreThanOneLineDocs;
663662
String get oneLineDoc;
664663
}
665664

@@ -1364,9 +1363,6 @@ abstract class ModelElement implements Comparable, Nameable, Documentable {
13641363
bool get hasDocumentation =>
13651364
documentation != null && documentation.isNotEmpty;
13661365

1367-
@override
1368-
bool get hasMoreThanOneLineDocs => _documentation.hasMoreThanOneLineDocs;
1369-
13701366
bool get hasParameters => parameters.isNotEmpty;
13711367

13721368
String get href;
@@ -1789,8 +1785,6 @@ class Package implements Nameable, Documentable {
17891785
// plain text or markdown.
17901786
bool get hasDocumentationFile => documentationFile != null;
17911787

1792-
bool get hasMoreThanOneLineDocs => true;
1793-
17941788
// TODO: make this work
17951789
String get href => 'index.html';
17961790

lib/templates/_callable.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
</span>
55
</dt>
66
<dd{{ #isInherited }} class="inherited"{{ /isInherited}}>
7-
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
7+
<p>{{{ oneLineDoc }}}</p>
88
{{#isInherited}}
99
<div class="features">inherited</div>
1010
{{/isInherited}}

lib/templates/_constant.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<span class="signature">&#8594; {{{ linkedReturnType }}}</span>
44
</dt>
55
<dd>
6-
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
6+
<p>{{{ oneLineDoc }}}</p>
77
<div>
88
<span class="signature"><code>{{{ constantValue }}}</code></span>
99
</div>

lib/templates/_has_more_docs.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

lib/templates/_property.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33
<span class="signature">&#8594; {{{ linkedReturnType }}}</span>
44
</dt>
55
<dd{{ #isInherited }} class="inherited"{{ /isInherited}}>
6-
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
6+
<p>{{{ oneLineDoc }}}</p>
77
{{>readable_writable}}
88
</dd>

lib/templates/class.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ <h2>Constructors</h2>
114114
<span class="name">{{{linkedName}}}</span><span class="signature">({{{ linkedParams }}})</span>
115115
</dt>
116116
<dd>
117-
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
117+
<p>{{{ oneLineDoc }}}</p>
118118
{{#isConst}}
119119
<div class="constructor-modifier features">const</div>
120120
{{/isConst}}

lib/templates/library.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ <h2>Enums</h2>
9191
{{{linkedName}}}
9292
</dt>
9393
<dd>
94-
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
94+
<p>{{{ oneLineDoc }}}</p>
9595
</dd>
9696
{{/library.enums}}
9797
</dl>
@@ -108,7 +108,7 @@ <h2>Classes</h2>
108108
<span class="name {{#isDeprecated}}deprecated{{/isDeprecated}}">{{{linkedName}}}</span>
109109
</dt>
110110
<dd>
111-
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
111+
<p>{{{ oneLineDoc }}}</p>
112112
</dd>
113113
{{/library.classes}}
114114
</dl>
@@ -125,7 +125,7 @@ <h2>Exceptions / Errors</h2>
125125
<span class="name {{#isDeprecated}}deprecated{{/isDeprecated}}">{{{linkedName}}}</span>
126126
</dt>
127127
<dd>
128-
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
128+
<p>{{{ oneLineDoc }}}</p>
129129
</dd>
130130
{{/library.exceptions}}
131131
</dl>

test/model_test.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,6 @@ void main() {
165165
'WOW FAKE PACKAGE IS <strong>BEST</strong> <a href="http://example.org">PACKAGE</a>'));
166166
});
167167

168-
test('has more than one line docs (or not)', () {
169-
expect(fakeLibrary.hasMoreThanOneLineDocs, true);
170-
expect(exLibrary.hasMoreThanOneLineDocs, false);
171-
});
172-
173168
test('has properties', () {
174169
expect(exLibrary.hasProperties, isTrue);
175170
});

0 commit comments

Comments
 (0)