Skip to content

Add links for more details in API docs. #1461

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 5 commits into from
Jun 20, 2017
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
12 changes: 11 additions & 1 deletion lib/src/model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,15 @@ abstract class ModelElement extends Nameable
return "(${p.toUri(sourceFileName)})";
}

/// Returns a link to extended documentation, or the empty string if that
/// does not exist.
String get extendedDocLink {
if (hasExtendedDocumentation) {
return '<a href="${href}">[...]</a>';
}
return '';
}

/// Returns the fully qualified name.
///
/// For example: libraryName.className.methodName
Expand Down Expand Up @@ -2415,7 +2424,8 @@ abstract class ModelElement extends Nameable
String get genericParameters => '';

@override
String get oneLineDoc => _documentation.asOneLiner;
String get oneLineDoc =>
'${_documentation.asOneLiner}${extendedDocLink.isEmpty ? "" : " $extendedDocLink"}';

ModelElement get overriddenElement => null;

Expand Down
4 changes: 2 additions & 2 deletions test/model_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void main() {
expect(
fakeLibrary.oneLineDoc,
equals(
'WOW FAKE PACKAGE IS <strong>BEST</strong> <a href="http://example.org">PACKAGE</a>'));
'WOW FAKE PACKAGE IS <strong>BEST</strong> <a href="http://example.org">PACKAGE</a> <a href="fake/fake-library.html">[...]</a>'));
});

test('has properties', () {
Expand Down Expand Up @@ -504,7 +504,7 @@ void main() {
expect(
add.oneLineDoc,
equals(
'Adds <code>value</code> to the end of this list,\nextending the length by one.'));
'Adds <code>value</code> to the end of this list,\nextending the length by one. <a href="fake/SpecialList/add.html">[...]</a>'));
});

test(
Expand Down
4 changes: 2 additions & 2 deletions testing/test_package_docs/ex/Apple-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ <h2>Properties</h2>
</span>
</dt>
<dd>
The getter for <code>s</code>
The getter for <code>s</code> <a href="ex/Apple/s.html">[...]</a>
<div class="features">read / write</div>
</dd>
<dt id="hashCode" class="property inherited">
Expand Down Expand Up @@ -206,7 +206,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd>
This is a method.
This is a method. <a href="ex/Apple/m1.html">[...]</a>

</dd>
<dt id="methodWithTypedefParam" class="callable">
Expand Down
2 changes: 1 addition & 1 deletion testing/test_package_docs/ex/B-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd>
This is a method.
This is a method. <a href="ex/B/m1.html">[...]</a>

</dd>
<dt id="writeMsg" class="callable">
Expand Down
2 changes: 1 addition & 1 deletion testing/test_package_docs/ex/Dog-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd>
Macro method
Macro method <a href="ex/Dog/withMacro.html">[...]</a>

</dd>
<dt id="withMacro2" class="callable">
Expand Down
2 changes: 1 addition & 1 deletion testing/test_package_docs/ex/F-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd class="inherited">
Macro method
Macro method <a href="ex/Dog/withMacro.html">[...]</a>
<div class="features">inherited</div>
</dd>
<dt id="withMacro2" class="callable inherited">
Expand Down
8 changes: 4 additions & 4 deletions testing/test_package_docs/ex/ex-library.html
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ <h2>Classes</h2>
<span class="name "><a href="ex/Apple-class.html">Apple</a></span>
</dt>
<dd>
Sample class <code>String</code>
Sample class <code>String</code> <a href="ex/Apple-class.html">[...]</a>
</dd>
<dt id="aThingToDo">
<span class="name "><a href="ex/aThingToDo-class.html">aThingToDo</a></span>
Expand All @@ -79,7 +79,7 @@ <h2>Classes</h2>
<span class="name "><a href="ex/B-class.html">B</a></span>
</dt>
<dd>
Extends class <a href="ex/Apple-class.html">Apple</a>, use <a href="ex/Apple/Apple.html">new Apple</a> or <a href="ex/Apple/Apple.fromString.html">new Apple.fromString</a>
Extends class <a href="ex/Apple-class.html">Apple</a>, use <a href="ex/Apple/Apple.html">new Apple</a> or <a href="ex/Apple/Apple.fromString.html">new Apple.fromString</a> <a href="ex/B-class.html">[...]</a>
</dd>
<dt id="Cat">
<span class="name "><a href="ex/Cat-class.html">Cat</a></span>
Expand Down Expand Up @@ -115,7 +115,7 @@ <h2>Classes</h2>
<span class="name "><a href="ex/Dog-class.html">Dog</a></span>
</dt>
<dd>
implements <a href="ex/Cat-class.html">Cat</a>, <a href="ex/E-class.html">E</a>
implements <a href="ex/Cat-class.html">Cat</a>, <a href="ex/E-class.html">E</a> <a href="ex/Dog-class.html">[...]</a>
</dd>
<dt id="E">
<span class="name "><a href="ex/E-class.html">E</a></span>
Expand Down Expand Up @@ -171,7 +171,7 @@ <h2>Classes</h2>
<span class="name "><a href="ex/ShapeType-class.html">ShapeType</a></span>
</dt>
<dd>
Foo bar.
Foo bar. <a href="ex/ShapeType-class.html">[...]</a>
</dd>
<dt id="SpecializedDuration">
<span class="name "><a href="ex/SpecializedDuration-class.html">SpecializedDuration</a></span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd>
Takes a <code>value</code> and returns a String.
Takes a <code>value</code> and returns a String. <a href="fake/BaseForDocComments/doAwesomeStuff.html">[...]</a>

</dd>
<dt id="noSuchMethod" class="callable inherited">
Expand Down
6 changes: 3 additions & 3 deletions testing/test_package_docs/fake/LongFirstLine-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ <h2>Constructors</h2>
<span class="name"><a href="fake/LongFirstLine/LongFirstLine.fromMap.html">LongFirstLine.fromMap</a></span><span class="signature">(<span class="parameter" id="fromMap-param-data"><span class="type-annotation">Map</span> <span class="parameter-name">data</span></span>)</span>
</dt>
<dd>
Named constructors are awesome.
Named constructors are awesome. <a href="fake/LongFirstLine/LongFirstLine.fromMap.html">[...]</a>
</dd>
</dl>
</section>
Expand Down Expand Up @@ -282,7 +282,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd class="inherited">
In the super class.
In the super class. <a href="fake/SuperAwesomeClass/fly.html">[...]</a>
<div class="features">inherited</div>
</dd>
<dt id="noSuchMethod" class="callable inherited">
Expand Down Expand Up @@ -390,7 +390,7 @@ <h2>Static Methods</h2>
</span>
</dt>
<dd>
Just a static method with no parameters.
Just a static method with no parameters. <a href="fake/LongFirstLine/staticMethodNoParams.html">[...]</a>

</dd>
<dt id="staticMethodReturnsVoid" class="callable">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd class="inherited">
Takes a <code>value</code> and returns a String.
Takes a <code>value</code> and returns a String. <a href="fake/BaseForDocComments/doAwesomeStuff.html">[...]</a>
<div class="features">inherited</div>
</dd>
<dt id="noSuchMethod" class="callable inherited">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ <h2>Methods</h2>
</span>
</dt>
<dd>
In the super class.
In the super class. <a href="fake/SuperAwesomeClass/fly.html">[...]</a>

</dd>
<dt id="noSuchMethod" class="callable inherited">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ <h2>Properties</h2>
</span>
</dt>
<dd>
Returns a length.
Returns a length. <a href="fake/WithGetterAndSetter/lengthX.html">[...]</a>
<div class="features">read / write</div>
</dd>
<dt id="hashCode" class="property inherited">
Expand Down
14 changes: 7 additions & 7 deletions testing/test_package_docs/fake/fake-library.html
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ <h2>Classes</h2>
<span class="name "><a href="fake/ConstantClass-class.html">ConstantClass</a></span>
</dt>
<dd>
For make-better testing of constants.
For make-better testing of constants. <a href="fake/ConstantClass-class.html">[...]</a>
</dd>
<dt id="Cool">
<span class="name "><a href="fake/Cool-class.html">Cool</a></span>
Expand Down Expand Up @@ -160,7 +160,7 @@ <h2>Classes</h2>
</dt>
<dd>
This is a very long line spread
across... wait for it... two physical lines.
across... wait for it... two physical lines. <a href="fake/LongFirstLine-class.html">[...]</a>
</dd>
<dt id="MixMeIn">
<span class="name "><a href="fake/MixMeIn-class.html">MixMeIn</a></span>
Expand Down Expand Up @@ -326,7 +326,7 @@ <h2>Constants</h2>
<span class="signature">&#8594; String</span>
</dt>
<dd>
Up is a direction.
Up is a direction. <a href="fake/UP-constant.html">[...]</a>

<div>
<span class="signature"><code>&#39;up&#39;</code></span>
Expand Down Expand Up @@ -399,7 +399,7 @@ <h2>Properties</h2>
</span>
</dt>
<dd>
The getter for setAndGet.
The getter for setAndGet. <a href="fake/setAndGet.html">[...]</a>
<div class="features">read / write</div>
</dd>
<dt id="simpleProperty" class="property">
Expand Down Expand Up @@ -442,7 +442,7 @@ <h2>Functions</h2>
</span>
</dt>
<dd>
This function has two parameters that are functions.
This function has two parameters that are functions. <a href="fake/functionWithFunctionParameters.html">[...]</a>

</dd>
<dt id="myGenericFunction" class="callable">
Expand Down Expand Up @@ -496,7 +496,7 @@ <h2>Functions</h2>
</span>
</dt>
<dd>
Testing <a href="fake/NAME_WITH_TWO_UNDERSCORES-constant.html">NAME_WITH_TWO_UNDERSCORES</a> should not be italicized.
Testing <a href="fake/NAME_WITH_TWO_UNDERSCORES-constant.html">NAME_WITH_TWO_UNDERSCORES</a> should not be italicized. <a href="fake/short.html">[...]</a>

</dd>
<dt id="soIntense" class="callable">
Expand Down Expand Up @@ -533,7 +533,7 @@ <h2>Functions</h2>
</span>
</dt>
<dd>
Top-level function 3 params and 1 optional positional param.
Top-level function 3 params and 1 optional positional param. <a href="fake/topLevelFunction.html">[...]</a>

</dd>
</dl>
Expand Down
4 changes: 2 additions & 2 deletions testing/test_package_docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ <h2>Libraries</h2>
<code class="language-dart">void main() {
// in Dart!
}
</code>
</code> <a href="code_in_comments/code_in_comments-library.html">[...]</a>
</dd>
<dt id="css">
<span class="name"><a href="css/css-library.html">css</a></span>
Expand All @@ -112,7 +112,7 @@ <h2>Libraries</h2>
<span class="name"><a href="fake/fake-library.html">fake</a></span>
</dt>
<dd>
WOW FAKE PACKAGE IS <strong>BEST</strong> <a href="http://example.org">PACKAGE</a>
WOW FAKE PACKAGE IS <strong>BEST</strong> <a href="http://example.org">PACKAGE</a> <a href="fake/fake-library.html">[...]</a>
</dd>
<dt id="is_deprecated">
<span class="name"><a class="deprecated" href="is_deprecated/is_deprecated-library.html">is_deprecated</a></span>
Expand Down
2 changes: 1 addition & 1 deletion testing/test_package_docs/two_exports/BaseClass-class.html
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ <h2>Properties</h2>
</span>
</dt>
<dd class="inherited">
Returns a length.
Returns a length. <a href="fake/WithGetterAndSetter/lengthX.html">[...]</a>
<div class="features">read / write, inherited</div>
</dd>
<dt id="runtimeType" class="property inherited">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ <h2>Properties</h2>
</span>
</dt>
<dd class="inherited">
Returns a length.
Returns a length. <a href="fake/WithGetterAndSetter/lengthX.html">[...]</a>
<div class="features">read / write, inherited</div>
</dd>
<dt id="runtimeType" class="property inherited">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ <h2>Classes</h2>
<span class="name "><a href="two_exports/ExtendingClass-class.html">ExtendingClass</a></span>
</dt>
<dd>
Extending class extends <a href="two_exports/BaseClass-class.html">BaseClass</a>.
Extending class extends <a href="two_exports/BaseClass-class.html">BaseClass</a>. <a href="two_exports/ExtendingClass-class.html">[...]</a>
</dd>
</dl>
</section>
Expand Down