代码之家  ›  专栏  ›  技术社区  ›  Leonardo

没有HTML替换为用于XML输出的Doxygen\逐字逐句块

  •  0
  • Leonardo  · 技术社区  · 2 年前

    问题

    我的一个标题中有以下片段:

    /**
     * @brief Simple function.
     * 
     * @verbatim 
     *     don't want the following to be rendered as &lt: > or \> !
     * @endverbatim
     * 
     * This function skips all \<li\> elements.
     */
    void simple(void) {}
    

    我正在运行Doxygen,在XML输出上我得到了:

    <memberdef kind="function" id="simple8hpp_1a6624a5381d71ba485b6c59bc71214607" prot="public" static="no" const="no" explicit="no" inline="no" virt="non-virtual">
        <detaileddescription>
    <para><verbatim>*     don&apos;t want the following to be rendered as &amp;lt: &gt; or \&gt; !
    * </verbatim></para>
    <para>This function skips all &lt;li&gt; elements. </para>
        </detaileddescription>
    </memberdef>
    

    <detaileddescription> ,我的原件 > 被替换 &gt 不要 想要那个。如何配置Doxygen以避免更换?

    我试过用脱氧剂 1.8.17 1.9.6 (c144c104ca2c0453cc5b19ce4c1b302cc2e4d929*) ,结果是一样的。

    根据 this answer 这个 \verbatim 块不应该取代那些。同时使用 \< 也应该起作用。

    完整上下文

    Doxygen实际上是由 Breathe 。我正在尝试创建一个ReTxT引用,如下所示:

    /**
     * @brief Simple function.
     * 
     * @verbatim 
     *     don't want the following to be rendered as &lt: > 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的帮助展示了如何创建 Doxygen alias :

    breathe_doxygen_aliases = {
        'rstref{1}': r'\verbatim embed:rst:inline :ref:`\1` \endverbatim'
    }
    

    上面的示例创建了 ReTxT cross-reference 形式为:

    It refers to the section itself, see :ref:`my-reference-label`.
    

    我想在表格中有一个参考资料:

    It refers to the section itself, see :ref:`not the title here<my-reference-label>`.
    

    因此 not the title here 是链接文本。

    我试着这样配置Breathe:

    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\>'
    }
    

    这产生了(显然正确的)以下Doxygen配置:

    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\>"
    

    但是在XML输出中 < > 正在被替换 &lt &gt :

        <detaileddescription>
    <para><verbatim>*     don&apos;t want the following to be rendered as &amp;lt: &gt; or \&gt; !
    * </verbatim></para>
    <para><verbatim>embed:rst:inline :ref:` not the title here&lt;my-reference-label&gt;` </verbatim></para>
    <para>This function skips all &lt;li&gt; elements. This function skips all &lt;li&gt; elements. This function skips all &lt;li&gt; elements. </para>
        </detaileddescription>
    

    这中断了随后的ReTxT处理,我没有得到链接。这个 rstref{1} 别名运行得很好:

    <verbatim>embed:rst:inline :ref:`custom0_pe_convert` </verbatim>
    

    我试着逃离 <> 别名定义中的符号:

    'rstref2{2}': r'\verbatim embed:rst:inline :ref:`\2\<\1\>` \endverbatim'
    

    这让我:

    ALIASES += rstref2{2}="\verbatim embed:rst:inline :ref:`\2\<\1\>` \endverbatim"
    

    但是XML仍然是错误的:

    <verbatim>embed:rst:inline :ref:` not the title here\&lt;my-reference-label\&gt;` </verbatim>
    

    使现代化

    我已尝试使用 Doxygen example 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;
      }
    }
    

    不幸的是Doxygen文档 don't show an example on how to use CDATA

    我仍然得到转义的XML:

    <codeline lineno="34"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>&lt;![CDATA[<sp/>test<sp/>&gt;<sp/>17;<sp/>]]&gt;</highlight></codeline>
    

    任何帮助我们的人都非常感激。

    干杯

    0 回复  |  直到 2 年前