The Problem
I have the following snippet in one of my headers:
/**
* @brief Simple function.
*
* @verbatim
* don't want the following to be rendered as <: > or \> !
* @endverbatim
*
* This function skips all \<li\> elements.
*/
void simple(void) {}
I'm running Doxygen and on the XML output I'm getting:
<memberdef kind="function" id="simple8hpp_1a6624a5381d71ba485b6c59bc71214607" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
<detaileddescription>
<para><verbatim>* don't want the following to be rendered as &lt: > or \> !
* </verbatim></para>
<para>This function skips all <li> elements. </para>
</detaileddescription>
</memberdef>
In the <detaileddescription>
, my original >
got replaced by >
. I do not want that. How can I configure Doxygen so that replacement doesn't happen?
I've tried using Doxygen 1.8.17
and 1.9.6 (c144c104ca2c0453cc5b19ce4c1b302cc2e4d929*)
, the result is the same.
According to this answer, the \verbatim
block should not replace those. Also escaping with \<
should also work.
Full Context
Doxygen is actually being called by Breathe. I'm trying to create a ReTxT reference like so:
/**
* @brief Simple function.
*
* @verbatim
* don't want the following to be rendered as <: > or \> !
* @endverbatim
*
* @rstref2{my-reference-label, not the title here}
*
* This function skips all \<li\> elements. This function skips all \verb{li} elements. This function skips all @verb{li} elements.
*
*/
void simple(void) {}
Breathe's help shows how to create a Doxygen alias:
breathe_doxygen_aliases = {
'rstref{1}': r'\verbatim embed:rst:inline :ref:`\1` \endverbatim'
}
The example above creates a ReTxT cross-reference in the form:
It refers to the section itself, see :ref:`my-reference-label`.
I want to have a reference in the form:
It refers to the section itself, see :ref:`not the title here<my-reference-label>`.
So that not the title here
is the link text.
I've tried to configure Breathe like so:
breathe_doxygen_aliases = {
'rstref{1}': r'\verbatim embed:rst:inline :ref:`\1` \endverbatim',
'rstref2{2}': r'\verbatim embed:rst:inline :ref:`\2<\1>` \endverbatim',
'verb{1}' : r'\<\1\>'
}
Which yields the (apparently correct) following Doxygen config:
ALIASES += rstref{1}="\verbatim embed:rst:inline :ref:`\1` \endverbatim"
ALIASES += rstref2{2}="\verbatim embed:rst:inline :ref:`\2<\1>` \endverbatim"
ALIASES += verb{1}="\<\1\>"
But in the XML output the <
and >
are being replaced by <
and >
:
<detaileddescription>
<para><verbatim>* don't want the following to be rendered as &lt: > or \> !
* </verbatim></para>
<para><verbatim>embed:rst:inline :ref:` not the title here<my-reference-label>` </verbatim></para>
<para>This function skips all <li> elements. This function skips all <li> elements. This function skips all <li> elements. </para>
</detaileddescription>
Which breaks the subsequent ReTxT processing and I don't get a link. The rstref{1}
alias works perfectly though:
<verbatim>embed:rst:inline :ref:`custom0_pe_convert` </verbatim>
I've tried escaping the <>
symbols in the alias definition:
'rstref2{2}': r'\verbatim embed:rst:inline :ref:`\2\<\1\>` \endverbatim'
Which gives me:
ALIASES += rstref2{2}="\verbatim embed:rst:inline :ref:`\2\<\1\>` \endverbatim"
But the XML is still wrong:
<verbatim>embed:rst:inline :ref:` not the title here\<my-reference-label\>` </verbatim>
Update
I've tried using CDATA from the Doxygen example and this answer:
/// <summary>
/// A search engine.
/// </summary>
class Engine
{
/// <summary>
/// The Search method takes a series of parameters to specify the search criterion
/// and returns a dataset containing the result set.
// <![CDATA[ test > 17; ]]>
/// </summary>
/// <param name="connectionString">the connection string to connect to the
/// database holding the content to search</param>
/// <param name="maxRows">The maximum number of rows to
/// return in the result set</param>
/// <param name="searchString">The text that we are searching for</param>
/// <returns>A DataSet instance containing the matching rows. It contains a maximum
/// number of rows specified by the maxRows parameter</returns>
public DataSet Search(string connectionString, int maxRows, int searchString)
{
DataSet ds = new DataSet();
return ds;
}
}
Unfortunately the Doxygen docs don't show an example on how to use CDATA
And I still get escaped XML:
<codeline lineno="34"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/><![CDATA[<sp/>test<sp/>><sp/>17;<sp/>]]></highlight></codeline>
Any help us much appreciatted.
Cheers!