Skip to content

Add manually-specified source code links to code #1913

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 11 commits into from
Jan 31, 2019
Merged

Conversation

jcollins-g
Copy link
Contributor

@jcollins-g jcollins-g commented Jan 29, 2019

Fixes #1454 and #1892. This adds a material icon for a source code link and calculates relative paths to insert into a link template specified by the user in a dartdoc_options.yaml file or on the command line. Verified the alignment in mobile and normal usage.

screenshot from 2019-01-29 11-28-15
screenshot from 2019-01-29 11-29-33

@googlebot googlebot added the cla: yes Google CLA check succeeded. label Jan 29, 2019
@coveralls
Copy link

coveralls commented Jan 29, 2019

Coverage Status

Coverage increased (+0.06%) to 93.966% when pulling f0d6c7e on link-to-source into 6fac6f7 on master.

@jcollins-g jcollins-g requested a review from devoncarew January 29, 2019 21:55
@jcollins-g
Copy link
Contributor Author

Updated icon based on feedback from @kwalrath. The rest of Dart/Flutter does not yet use material, but until then, description fits better stylistically.
screenshot from 2019-01-29 14-55-36

Copy link
Member

@devoncarew devoncarew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

specified by the user in a dartdoc_options.yaml file or on the command line

Perhaps add a section in the readme.md w/ instructions for how to ensure generated docs link to their github source?

@@ -3215,6 +3216,15 @@ abstract class ModelElement extends Canonicalization
return _documentationFrom;
}

bool get hasSourceHref => sourceHref != '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.isNotEmpty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

bool get hasSourceHref => sourceHref != '';
String _sourceHref;
String get sourceHref {
if (_sourceHref == null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_sourceHref ??= new SourceLinker.fromElement(this).href(); ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@jcollins-g
Copy link
Contributor Author

Added an example and set it up to work for dartdoc itself when it gets published.

@jcollins-g jcollins-g merged commit 5a4308d into master Jan 31, 2019
@jcollins-g jcollins-g deleted the link-to-source branch January 31, 2019 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants