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 wrong refid when SEPARATE_MEMBER_PAGES is YES #566

Merged
merged 1 commit into from
Sep 10, 2020

Conversation

utzig
Copy link
Contributor

@utzig utzig commented Aug 18, 2020

When Doxygen is configured the SEPARATE_MEMBER_PAGES set to YES, the following Doxygen input:

/**
 * This struct must be used with f()
 */
struct t {
  int x;
}

/**
 * @param tx A struct t pointer
 */
void f(struct t *tx) {
  (void)tx;
}

The f() in struct t's comment generates a element with refid equal to some_prefix_compoundid_anchorid, wheres the id in the refered element ends up with an id equal to some_prefix_anchorid. The anchorid here is the compoundid prefix by "_1", with one or two extra 'g' prefixes for groups, so the refid actually has this information duplicated.

This is a band-aid solution that, when configured enabled in conf.py, tries to detect the issue in the refids and removes the extra baggage, so resulting links work.

@utzig
Copy link
Contributor Author

utzig commented Aug 18, 2020

This is clearly a bug in Doxygen's xmlgen, so I will submit a fix there soon. This works as a band-aid and I hope without side-effects.

@utzig utzig force-pushed the fix-ref-refid branch 2 times, most recently from cff4e4f to 0df7eb9 Compare August 18, 2020 21:19
@utzig utzig changed the title Fix wrong refid in Doxygen's XML generator [DNM]Fix wrong refid in Doxygen's XML generator Aug 19, 2020
@utzig utzig changed the title [DNM]Fix wrong refid in Doxygen's XML generator [DNM] Fix wrong refid in Doxygen's XML generator Aug 19, 2020
@utzig utzig changed the title [DNM] Fix wrong refid in Doxygen's XML generator Fix wrong refid when SEPARATE_MEMBER_PAGES is YES Sep 4, 2020
@utzig
Copy link
Contributor Author

utzig commented Sep 4, 2020

@vermeeren I updated this PR now that it got clearer what the source of the issue was, doxygen/doxygen#7971 (comment); it works OK for our projects which are rather big but it's hard to say if it handles all possible permutations of ids created by Doxygen, but I guess it does.

@vermeeren vermeeren self-assigned this Sep 4, 2020
@vermeeren vermeeren added code Source code enhancement Improvements, additions (also cosmetics) labels Sep 4, 2020
Copy link
Collaborator

@vermeeren vermeeren left a comment

Choose a reason for hiding this comment

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

@utzig Good implementation with a new config value, I like this. Just a few minor doc related things I noticed, can you check?

breathe/renderer/sphinxrenderer.py Outdated Show resolved Hide resolved
breathe/renderer/sphinxrenderer.py Outdated Show resolved Hide resolved
documentation/source/directives.rst Outdated Show resolved Hide resolved
documentation/source/directives.rst Outdated Show resolved Hide resolved
When Doxygen is configured the SEPARATE_MEMBER_PAGES set to YES, the
following Doxygen input:

```
/**
 * This struct must be used with f()
 */
struct t {
  int x;
}

/**
 * @param tx A struct t pointer
 */
void f(struct t *tx) {
  (void)tx;
}
```

The `f()` in struct t's comment generates a <ref> element with `refid`
equal to `some_prefix_compoundid_anchorid`, wheres the `id` in the
refered element ends up with an `id` equal to `some_prefix_anchorid`.
The anchorid here is the compoundid prefix by "_1", with one or two
extra 'g' prefixes for groups, so the `refid` actually has this
information duplicated.

This is a band-aid solution that, when configured enabled in conf.py,
tries to detect the issue in the refids and removes the extra baggage,
so resulting links work.

Signed-off-by: Fabio Utzig <[email protected]>
@vermeeren vermeeren merged commit fe7bf83 into breathe-doc:master Sep 10, 2020
vermeeren added a commit that referenced this pull request Sep 10, 2020
@vermeeren
Copy link
Collaborator

@utzig Just released v4.21.0 with both PRs, thanks again!

@utzig utzig deleted the fix-ref-refid branch September 11, 2020 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code Source code enhancement Improvements, additions (also cosmetics)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants