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

Doxyrest does not provide value for #define(s) in .rst files #50

Open
mateasmario opened this issue Feb 6, 2022 · 1 comment
Open

Comments

@mateasmario
Copy link

mateasmario commented Feb 6, 2022

I'm trying to generate documentation for a C++ source code (file main.cpp) using Doxygen, doxyrest and Sphinx.
The source code looks like this:

/*! \file main.cpp
    \brief A Documented file.
    
    Details.
*/
 
/*! \def MAXIMUMSIZE
	
    \brief A macro that returns the maximum
   
    Details.
*/
#define MAXIMUMSIZE 20

//! A public variable.
/*!
    Details.
*/
    int publicVar = 3;

I have both GENERATE_HTML and GENERATE_XML enabled in Doxygen, and everything seems to be fine.
The problem is when I'm trying to generate .rst files based on my newly generated xml-dir folder. I've seen that the value of the publicVar integer is written in the rst(s), but MAXIMUMSIZE's value is not.
image

I need my Sphinx documentation to also provide the value of the #define, not only its name.

This is how Sphinx looks like:
image

And I want it to be like that:
image

Is there any stuff in doxyrest-config.lua I need to change in order to keep the macro values?

@LexouDuck
Copy link

There is indeed a simple enough workaround for this, which I use in my own projects.

You need to add a line of code to the doxyrest/frame/cfamily/utils.lua file, at line 505:

function getDefineDeclString(define, nameTemplate, indent)
	local s = "#define "

	s = s .. fillItemNameTemplate(nameTemplate, define.name, define.id)

	if #define.paramArray > 0 then
		-- no space between name and params!

		s = s .. getParamArrayString(s, define.paramArray, false, "(", ")", indent, " \\\n")
	end

>	s = s .. '\t' .. getLinkedTextString(define.initializer, true)

	return s
end

You can see the line of code in question, I put a > character at the beginning of the line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants