My doxygen documentation shows the source-code of each class member function.
My source code sometimes contains multiple blank lines between functions.
How can I get doxygen to compact or strip these multiple blank lines?
(instead of showing them in the preview)
ANSWER (from below)
The answer below pointed me in the right direction: INPUT_FILTER (doxygen documentation)
The INPUT_FILTER tag can be used to specify a program that doxygen should invoke to filter for each input file. Doxygen will invoke the filter program by executing (via popen()) the command:
<filter> <input-file>
where is the value of the INPUT_FILTER tag, and is the name of an input file. Doxygen will then use the output that the filter program writes to standard output.
I quickly wrote a python script (I’m on Win7) that does the ‘compacting’:
import re
import sys
if len(sys.argv) != 2:
exit()
with open(sys.argv[1]) as f:
original = f.read()
compact = re.sub('\n\n\n+', '\n\n', original)
print(compact)
Then I added it to the filter:
INPUT_FILTER = "python ../DoxyCompact.py"
This also opens up A LOT of possibilities to modify the source before doxygen reads it!
The only way I can think of doing this is to define some preprocessor to strip the multiple blank lines before doxygen uses the source code in the documentation. To define an action (or filter) to perform on the source files use the
INPUT_FILTERconfiguration file option.Warning: The following has not been tested.
From the question How can I replace multiple empty lines with a single empty line in bash? it seems that one can use
to strip multiple blank lines, so in your configuration file, set