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

[Implement #3379] Add table of contents at the beginning of HTML formatted output #3472

Merged
merged 1 commit into from Sep 5, 2016

Conversation

Projects
None yet
2 participants
@hedgesky
Contributor

hedgesky commented Sep 4, 2016

This PR implements #3379: now the list of offended files with links to them is generated at the beginning of HTML formatted output, giving us ability to quickly navigate to a particular place. As a nice side effect, now it's easy to craft a link to a certain place in report. It could be handy in some situations.

@@ -70,14 +70,13 @@
line-height: 2.2rem;
margin: 0 0 0.5em;
}
.information .infobox ul {

This comment has been minimized.

@hedgesky

hedgesky Sep 4, 2016

Contributor

This style section was unused (there were no lists in .information .infobox), so I removed it. Behavior of changing headers while scrolling practically didn't change.

@hedgesky

hedgesky Sep 4, 2016

Contributor

This style section was unused (there were no lists in .information .infobox), so I removed it. Behavior of changing headers while scrolling practically didn't change.

@@ -191,7 +190,7 @@
idx,
scrollY = window.scrollY;
for (i = 0; i < boxPositions.length; i++) {
if (scrollY <= boxPositions[i]) {
if (scrollY <= boxPositions[i] - 1) {

This comment has been minimized.

@hedgesky

hedgesky Sep 4, 2016

Contributor

Subtracting one pixel is required to properly set up fixed file header after navigating to an anchor.

@hedgesky

hedgesky Sep 4, 2016

Contributor

Subtracting one pixel is required to properly set up fixed file header after navigating to an anchor.

@bbatsov

This comment has been minimized.

Show comment
Hide comment
@bbatsov

bbatsov Sep 4, 2016

Collaborator

Can you attach a screenshot of the new functionality?

Collaborator

bbatsov commented Sep 4, 2016

Can you attach a screenshot of the new functionality?

@hedgesky

This comment has been minimized.

Show comment
Hide comment
@hedgesky

hedgesky Sep 5, 2016

Contributor

Sure.
2016-09-05 12 33 56

After clicking on a link:
2016-09-05 12 33 25

Also, you may notice that anchor part pattern is "offense_#{path_to_offended_file}". I decided to use a prefix to avoid probability of clashing ids (which is low, but anyway).

Contributor

hedgesky commented Sep 5, 2016

Sure.
2016-09-05 12 33 56

After clicking on a link:
2016-09-05 12 33 25

Also, you may notice that anchor part pattern is "offense_#{path_to_offended_file}". I decided to use a prefix to avoid probability of clashing ids (which is low, but anyway).

@bbatsov bbatsov merged commit 6f66c29 into rubocop-hq:master Sep 5, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@hedgesky hedgesky deleted the hedgesky:3379_add_toc_to_html_formatter branch Sep 5, 2016

Neodelf added a commit to Neodelf/rubocop that referenced this pull request Oct 15, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment