Skip to content
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

Fix nav links of synonymous sub-headings under Associations #12201

Merged
merged 6 commits into from
May 12, 2020

Conversation

louy2
Copy link
Contributor

@louy2 louy2 commented May 1, 2020

Pull Request check-list

Please make sure to review and check all of these items:

  • Does npm run test or npm run test-DIALECT pass with this change (including linting)?
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Have you added new tests to prevent regressions?
  • Is a documentation update included (if this change modifies existing APIs, or introduces new ones)?
  • Did you update the typescript typings accordingly (if applicable)?
  • Did you follow the commit message conventions explained in CONTRIBUTING.md?

Description of change

Added new transform fix-ids.js to fix sub-heading ids and links under Association.

Closes #12197

@louy2
Copy link
Contributor Author

louy2 commented May 1, 2020

Not sure how to add test for this one.

@codecov
Copy link

codecov bot commented May 1, 2020

Codecov Report

Merging #12201 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #12201   +/-   ##
=======================================
  Coverage   96.33%   96.33%           
=======================================
  Files          95       95           
  Lines        9120     9120           
=======================================
  Hits         8786     8786           
  Misses        334      334           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5336424...cde6f6b. Read the comment docs.

Copy link
Member

@papb papb left a comment

Choose a reason for hiding this comment

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

Hello! I see you are a first-time contributor, thank you for taking the time to help Sequelize! I hope to see more PRs from you in the future!

Thanks for catching the fact that cheerio was missing from devDependencies! 🚀 I either deleted it by accident at some point, or never added it 😅

As for your PR, although it does work, I was hoping for something less specific, that would automatically adapt to further documentation changes.

Would you be willing to improve your PR? I suggest something on the lines of:

  • Detect every heading with an ID: $('h1,h2,h3,h4,h5').filter('[id]')
  • Find duplicate IDs among them
  • Replace their IDs with the following rule:
    #original-header --> #original-header
    #original-header --> #original-header-2
    #original-header --> #original-header-3
    
  • Also fix nav links (nice catch, I didn't think of that!) - you can assume that the links appear in nav in the same order they do in the page itself. To find the links you might use something like
    $('li[data-ice="manualNav"] a').filter(function() {
      return $(this).prop('href').endsWith(`${fileName}#${headerBeingFixed}`);
    });

Not sure how to add test for this one.

Don't worry about a test, I think it's not necessary in this case, provided we manually check that it works.

@papb papb added status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action type: docs For issues and PRs. Things related to documentation, such as changes in the manuals / API reference. labels May 1, 2020
@louy2
Copy link
Contributor Author

louy2 commented May 3, 2020

Got confused by the mechanics of _.chain but got it working

@louy2
Copy link
Contributor Author

louy2 commented May 3, 2020

Also apparently id can only be set with attr.

Copy link
Contributor

@sushantdhiman sushantdhiman left a comment

Choose a reason for hiding this comment

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

LGTM, waiting for @papb

@papb papb merged commit 784712e into sequelize:master May 12, 2020
@papb
Copy link
Member

papb commented May 12, 2020

Great work @louy2, thank you very much!!

@papb papb removed the status: awaiting response For issues and PRs. OP must respond (or change something, if it is a PR). Maintainers have no action label May 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: docs For issues and PRs. Things related to documentation, such as changes in the manuals / API reference.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The Philosophy Goal Implementation links all point to One-to-One
3 participants