1

I'm using the \snippet examples.cpp xml_map::fixup command in doxygen 1.8.14 to generate the following...

enter image description here

Which is derived from the following unit test code...

    TEST_METHOD(fixup) {
        /// [xml_map::fixup]
        // The source xml, but with elements missing, unmapped elements,
        // and elements in a different order than in the map.
        std::string xml{
            "<map>\n"
            "\t<first_unmapped_element/>\n"
            "\t<double_element/>\n"
            "\t<second_unmapped_element/>\n"
            "\t<bool_element/>\n"
            "</map>\n"
        };

        xml::xml_map<map_elements> xml_map(xml, map);

        // Mapped elements that are missing from the source xml are added, elements
        // not mapped are removed, and elements are sorted according to their order in the map.
        xml_map.fixup();

        std::string expected_xml{
            "<map>\n"
            "\t<bool_element/>\n"
            "\t<double_element/>\n"
            "\t<array_element/>\n"
            "</map>\n"
        };
        Assert::AreEqual(expected_xml.c_str(), xml_map.xml().c_str());
        /// [xml_map::fixup]
    }

The indentation is caused by the code being part of a unit test method, which is part of a unit test class, which is under a namespace, causing three levels of indentation before the meat of my snippet. Basically doxygen is reflecting the white space of the unit test method verbatim. I would like my doxygen output to look more like this...

enter image description here

I've looked through the doxygen documentation and I can't find if this is possible. Any hints or solutions are appreciated.

John Stritenberger
  • 1,194
  • 1
  • 12
  • 30
  • First a MWE showing the problem and the used doxygen version would be nice. When you write "I would like doxygen to ignore the leading white space" I think you mean the white space before e.g the comment and the std but leave some indentation before the strings (the 4 spaces). At the moment I don't see directly a solution. – albert May 02 '19 at 15:53
  • The unit test code is this written by hand or automatically and not, normally, intended for humans to read? Can you influence the code generation of this test class? Is the test unit code / documentation used in the documentation elsewhere (i.e. is it just in the `EXAMPLE_PATH` or also in `INPUT` configuration) ? – albert May 02 '19 at 16:20
  • The test code is hand written and intended to both test functionality and demonstrate usage to end users. I could change the unit test code, adjust my IDE's indentation style, etc but that opens up a whole new bag of issues. The indentation that doxygen generates shown isn't a deal breaker, but I would prefer my text to be left justified. If there's not a relatively simple way to do that in doxygen, I'll just leave it as it is. – John Stritenberger May 02 '19 at 17:26
  • I did some further tests (with filters) but I have not found a solution. – albert May 02 '19 at 17:41
  • I've just pushed a proposed pull request regarding this issue: https://github.com/doxygen/doxygen/pull/9827 – albert Jan 30 '23 at 17:09
  • Code of https://github.com/doxygen/doxygen/pull/9827 has been integrated in master on GitHub – albert Feb 05 '23 at 13:51

0 Answers0