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 #7276: cpp: objects generate hypertarget names unexpectedly #7277
Conversation
Codecov Report
@@ Coverage Diff @@
## 3.x #7277 +/- ##
==========================================
+ Coverage 84.01% 84.05% +0.04%
==========================================
Files 281 279 -2
Lines 43398 43221 -177
Branches 6329 6299 -30
==========================================
- Hits 36459 36328 -131
+ Misses 5559 5520 -39
+ Partials 1380 1373 -7
Continue to review full report at Codecov.
|
@@ -6512,10 +6512,6 @@ def add_target_and_index(self, ast: ASTDeclaration, sig: str, signode: desc_sign | |||
names = self.env.domaindata['cpp']['names'] | |||
if name not in names: | |||
names[name] = ast.symbol.docname | |||
signode['names'].append(name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I can reproduce the warning this is supposed to fix, but I don't actually know where it comes from. Do you know where it is generated from? (perhaps inside docutils?) In short: besides avoiding the warning I'm actually not sure what the specific effect of removing this line is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the warning came from inside docutils.
In short: besides avoiding the warning I'm actually not sure what the specific effect of removing this line is.
In docutils world, node['names']
is used to create a hyperlink target that is able to refer via its name. On the other hand, Sphinx provides some roles (ex. :cpp:func:
) to realize the cross-reference feature because docutils does not support a reference between multiple documents. Therefore, it is not needed to generate names for the hyperlink target.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, looks good to merge.
Indeed. IDs are generated from the declaration such that clashes can never happen (assuming no bugs). As features are added there has been a need to change IDs for existing objects. There are thus multiple IDs for the same entity (currently |
5ea7a8f
to
22084ad
Compare
Thank you for reviewing! merged. |
Feature or Bugfix
Purpose
signode['names']
assignment. Is my understand correct?make_id()
. But cpp domain is too complicated to me. And it seems it already has its own ID generation engine. So it does not cause a problem like some domain directives generate wrong target ID #6903. So I'd like to keep as is now.@jakobandersen Could you review this and give an advice to me.