-
-
Notifications
You must be signed in to change notification settings - Fork 202
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
Cross-referencing to a doxygenfile from Sphinx #373
Comments
I think it is not possible for Sphinx to "fix" this, since a file isn't really a C/C++ type or anything like that. However, apidoc could be modified to automatically generate section labels above the page header for file types. So that File add.h
==========
.. doxygenfile:: add.h Would turn into .. _apidoc_file_add.h:
File add.h
==========
.. doxygenfile:: add.h or similar. A potential problem would be when there are multiple files with the same name in different directories. Using the full path should fix that however. What would you like to see? |
Would using the same name that is given to the |
You are right, that indeed must be unique enough. A possible implementation of #321 may solve this issue too, though it is mainly about generating some index instead of being able to reference directly in other RST. What do you think about 321? Would it fulfil your use case or would you rather be able to reference to a page directly without generating an index? |
I was hoping to be able to just reference a page directly, something like this: Function `add` can be found in :ref:`apidoc_file_add.h` Currently, I'm linking directly to the rst file itself: Function `add` can be found in :doc:`add.h<../_breathe_autogen/file/add_8h>`: which is not the worst thing in the world, but feels a little fragile, along with having to know the doxygen-encoded name of the file. Your suggestion of generating the section labels would be enough for my use case. |
How about the following solution?
|
@ZedThree making apidoc creating per-page labels should be pretty easy, but do think @jakobandersen 's proposal will be a lot more flexible since it will probably also support linking to a specific class/func/etc on the destination page rather than just the page itself. |
That would also work for me! 👍 |
@ZedThree I've hacked sphinx labels into the rst files which breathe-apidoc generates. The code is for i in `ls group/group_*.rst`
do
name=$(sed -e '$!d' -e 's/.*doxygengroup:: \(.*\)$/\1/' $i)
sed -i "1s/^/.. _Group ${name}:\n\n/" $i
done
for i in `ls file/*.rst`
do
name=$(sed -e '$!d' -e 's/.*doxygenfile:: \(.*\)$/\1/' $i)
sed -i "1s/^/.. _File ${name}:\n\n/" $i
done not nice but it works so far. |
I stumble upon this issue when moving from a manual list of .. doxygenfunction:: xt::foo
.. doxygenfunction:: xt::bar
.. doxygenfunction:: xt::baz to .. doxygengroup:: xt_group All previous references to
|
I'd like to link to a
doxygenfile
directive from Sphinx, but I can't find anything that does this. Sphinx supports cross-referencing to various declaration types --file
is missing, so is this something that needs to be done on the Sphinx side? Or have I just missed something?As a note, I've generated the documentation using
breathe-apidoc
. A workaround would be to have that generate a section label which could be linked to with:ref:
, which would be pretty easy to do.The text was updated successfully, but these errors were encountered: