Skip to content

show the entire text for the first line of dartdoc #1181

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/resources/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ dd.callable, dd.constant, dd.property {
}

dd p {
white-space: nowrap;
overflow-x: hidden;
text-overflow: ellipsis;
margin-bottom: 0;
Expand Down
3 changes: 0 additions & 3 deletions lib/src/html/templates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import 'resource_loader.dart' as loader;
typedef String TemplateRenderer(context,
{bool assumeNullNonExistingProperty, bool errorOnMissingProperty});

// TODO: if we can ever enumerate the contents of a package, we
// won't need this.
const _partials = const <String>[
'callable',
'callable_multiline',
Expand All @@ -26,7 +24,6 @@ const _partials = const <String>[
'sidebar_for_class',
'source_code',
'sidebar_for_library',
'has_more_docs',
'accessor_getter',
'accessor_setter'
];
Expand Down
18 changes: 6 additions & 12 deletions lib/src/markdown_processor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ class Documentation {
final String raw;
final String asHtml;
final String asOneLiner;
final bool hasMoreThanOneLineDocs;

factory Documentation(String markdown) {
String tempHtml = _renderMarkdownToHtml(markdown);
Expand All @@ -175,8 +174,7 @@ class Documentation {
return new Documentation._internal(element.documentation, tempHtml);
}

Documentation._(
this.raw, this.asHtml, this.hasMoreThanOneLineDocs, this.asOneLiner);
Documentation._(this.raw, this.asHtml, this.asOneLiner);

factory Documentation._internal(String markdown, String rawHtml) {
var asHtmlDocument = parse(rawHtml);
Expand Down Expand Up @@ -206,18 +204,14 @@ class Documentation {
}
var asHtml = asHtmlDocument.body.innerHtml;

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

var asOneLiner = '';
var moreThanOneLineDoc = asHtmlDocument.body.children.length > 1;
var asOneLiner = asHtmlDocument.body.children.isEmpty
? ''
: asHtmlDocument.body.children.first.innerHtml;

if (asHtmlDocument.body.children.isNotEmpty) {
asOneLiner = asHtmlDocument.body.children.first.innerHtml;
}

return new Documentation._(
markdown, asHtml, moreThanOneLineDoc, asOneLiner);
return new Documentation._(markdown, asHtml, asOneLiner);
}
}

Expand Down
6 changes: 0 additions & 6 deletions lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,6 @@ abstract class Documentable {
String get documentation;
String get documentationAsHtml;
bool get hasDocumentation;
bool get hasMoreThanOneLineDocs;
String get oneLineDoc;
}

Expand Down Expand Up @@ -1363,9 +1362,6 @@ abstract class ModelElement implements Comparable, Nameable, Documentable {
bool get hasDocumentation =>
documentation != null && documentation.isNotEmpty;

@override
bool get hasMoreThanOneLineDocs => _documentation.hasMoreThanOneLineDocs;

bool get hasParameters => parameters.isNotEmpty;

String get href;
Expand Down Expand Up @@ -1788,8 +1784,6 @@ class Package implements Nameable, Documentable {
// plain text or markdown.
bool get hasDocumentationFile => documentationFile != null;

bool get hasMoreThanOneLineDocs => true;

// TODO: make this work
String get href => 'index.html';

Expand Down
2 changes: 1 addition & 1 deletion lib/templates/_callable.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
</span>
</dt>
<dd{{ #isInherited }} class="inherited"{{ /isInherited}}>
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
<p>{{{ oneLineDoc }}}</p>
{{#isInherited}}
<div class="features">inherited</div>
{{/isInherited}}
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/_constant.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<span class="signature">&#8594; {{{ linkedReturnType }}}</span>
</dt>
<dd>
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
<p>{{{ oneLineDoc }}}</p>
<div>
<span class="signature"><code>{{{ constantValue }}}</code></span>
</div>
Expand Down
3 changes: 0 additions & 3 deletions lib/templates/_has_more_docs.html

This file was deleted.

2 changes: 1 addition & 1 deletion lib/templates/_property.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
<span class="signature">&#8594; {{{ linkedReturnType }}}</span>
</dt>
<dd{{ #isInherited }} class="inherited"{{ /isInherited}}>
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
<p>{{{ oneLineDoc }}}</p>
{{>readable_writable}}
</dd>
2 changes: 1 addition & 1 deletion lib/templates/class.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ <h2>Constructors</h2>
<span class="name">{{{linkedName}}}</span><span class="signature">({{{ linkedParams }}})</span>
</dt>
<dd>
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
<p>{{{ oneLineDoc }}}</p>
{{#isConst}}
<div class="constructor-modifier features">const</div>
{{/isConst}}
Expand Down
6 changes: 3 additions & 3 deletions lib/templates/library.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h2>Enums</h2>
{{{linkedName}}}
</dt>
<dd>
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
<p>{{{ oneLineDoc }}}</p>
</dd>
{{/library.enums}}
</dl>
Expand All @@ -108,7 +108,7 @@ <h2>Classes</h2>
<span class="name {{#isDeprecated}}deprecated{{/isDeprecated}}">{{{linkedName}}}</span>
</dt>
<dd>
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
<p>{{{ oneLineDoc }}}</p>
</dd>
{{/library.classes}}
</dl>
Expand All @@ -125,7 +125,7 @@ <h2>Exceptions / Errors</h2>
<span class="name {{#isDeprecated}}deprecated{{/isDeprecated}}">{{{linkedName}}}</span>
</dt>
<dd>
<p>{{{ oneLineDoc }}}{{>has_more_docs}}</p>
<p>{{{ oneLineDoc }}}</p>
</dd>
{{/library.exceptions}}
</dl>
Expand Down
5 changes: 0 additions & 5 deletions test/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ void main() {
'WOW FAKE PACKAGE IS <strong>BEST</strong> <a href="http://example.org">PACKAGE</a>'));
});

test('has more than one line docs (or not)', () {
expect(fakeLibrary.hasMoreThanOneLineDocs, true);
expect(exLibrary.hasMoreThanOneLineDocs, false);
});

test('has properties', () {
expect(exLibrary.hasProperties, isTrue);
});
Expand Down