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

js domain: Generate node_id in the right way #7210

Merged
merged 4 commits into from
Feb 29, 2020

Conversation

tk0miya
Copy link
Member

@tk0miya tk0miya commented Feb 23, 2020

Feature or Bugfix

  • Bugfix

Purpose

  • refs: some domain directives generate wrong target ID #6903
  • So far, JS domain generates node_ids (a.k.a. target id) from their object name (ex. func from .. js:function:: func()).
  • JS domain checks conflicts of node_ids between JS objects. But it does not check for other domains. Therefore, they are often conflicted.
  • In addition, the generated node_ids do not obey the rule of docutils specification.
  • On the other hand, this makes an incompatible changes for domain internal data.

@tk0miya tk0miya added this to the 3.0.0 milestone Feb 23, 2020
sphinx/domains/javascript.py Show resolved Hide resolved
sphinx/domains/javascript.py Show resolved Hide resolved
assert (find_obj(None, None, 'NestedParentA.NestedChildA', 'class') ==
('NestedParentA.NestedChildA', ('roles', 'class')))
('NestedParentA.NestedChildA',
('roles', 'nestedparenta-nestedchilda', 'class')))
Copy link
Member Author

Choose a reason for hiding this comment

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

This is good example for new_id. It is regulated to small case and invalid characters are converted to hyphens.

CHANGES Outdated Show resolved Hide resolved

def note_object(self, fullname: str, objtype: str, location: Any = None) -> None:
def note_object(self, fullname: str, objtype: str, node_id: str,
location: Any = None) -> None:
Copy link
Member Author

Choose a reason for hiding this comment

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

This method takes an additional argument node_id. It would be a breaking change...

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought other APIs in JS domain are also changed. And I don't have good idea to keep compatibility. So I'm going with this implementation.

@tk0miya tk0miya force-pushed the refactor_js_domain2 branch 2 times, most recently from 07b3d34 to 21719c1 Compare February 29, 2020 11:05
Copy link
Member

@shimizukawa shimizukawa left a comment

Choose a reason for hiding this comment

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

LGTM with 1 proposal.

sphinx/domains/javascript.py Show resolved Hide resolved
CHANGES Outdated Show resolved Hide resolved
@tk0miya
Copy link
Member Author

tk0miya commented Feb 29, 2020

Thank you for reviewing!

@tk0miya tk0miya merged commit 2014559 into sphinx-doc:3.x Feb 29, 2020
@tk0miya tk0miya deleted the refactor_js_domain2 branch February 29, 2020 16:54
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants