对于C ++代码,doxygen对\code{.markdown}
没有不可克服的问题。
例如
//===========================================================================
//! \defgroup markdown_cpp C++ markdown test
//! \brief test cpp markdown
//! \date 2018 March
//!
//! \code{.markdown}
//! ______
//! | |
//! x ->-| |->- y
//! |______|
//! \endcode
//===========================================================================
int test(void)
{
const unsigned x=3;
return x*2;
}
并在.tex
文件中生成
\begin{DoxyCode}
\_\_\_\_\_\_
| |
x ->-| |->- y
|\_\_\_\_\_\_|
\end{DoxyCode}
然而,在VHDL代码中,Windows 10上的doxygen崩溃(" doxygen.exe已停止工作") 当我尝试这个时:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
-----------------------------------------------------------------------------
--! \defgroup markdown_vhd VHDL markdown test
--! \ingroup markdown_vhd
--!
--! \code{.markdown}
--! ______
--! | |
--! x1 ->-| |
--! | |->- y
--! x2 ->-| |
--! |______|
--! \endcode
-----------------------------------------------------------------------------
entity test is
port (--inpts
x1 : in std_logic;
x2 : in std_logic;
--outputs
y : out std_logic;
);
end entity test;
architecture test_arch of test is
begin
y <= x1 xor x2;
end architecture test_arch;
答案 0 :(得分:1)
The syntax for your doxygen comment in your example is correct. This is resulting in a crash which is a bug (tested in doxygen 1.8.11 in windows).
All commands in the documentation start with a backslash (\) or an at-sign (@), see doxygen manual. To achieve the exact same (intended) result, use the following:
--! @code{.markdown}
--! ______
--! | |
--! x1 ->-| |
--! | |->- y
--! x2 ->-| |
--! |______|
--! @endcode
It will not crash in doxygen (tested in 1.8.11 on windows).
produced html result for code:
You may also be interested in the following variant:
--! \verbatim
--! ______
--! | |
--! x1 ->-| |
--! | |->- y
--! x2 ->-| |
--! |______|
--! \endverbatim
The outcome is different:
produced html result for verbatim:
Note 1: I do not have the latest version installed on my machine which is why I used an slightly older version. It will hopefully not affect the provided solution.
Note 2: Workaround had been successfully tested for 1.8.14 by OP.
答案 1 :(得分:0)
Windows 10上的Doxygen 1.8.14的所有以下工作:
--!
--! @code{.markdown}
--! ______
--! | |
--! x1 ->-| |
--! | |->- y
--! x2 ->-| |
--! |______|
--! @endcode
--!
--! \verbatim
--! ______
--! | |
--! x1 ->-| |
--! | |->- y
--! x2 ->-| |
--! |______|
--! \endverbatim
--!
--! @verbatim
--! ______
--! | |
--! x1 ->-| |
--! | |->- y
--! x2 ->-| |
--! |______|
--! @endverbatim
这些产生以下LaTeX代码:
\begin{DoxyCode}
\_\_\_\_\_\_
| |
x1 ->-| |
| |->- y
x2 ->-| |
|\_\_\_\_\_\_|
\end{DoxyCode}
\begin{DoxyVerb} ______
| |
x1 ->-| |
| |->- y
x2 ->-| |
|______|\end{DoxyVerb}
\begin{DoxyVerb} ______
| |
x1 ->-| |
| |->- y
x2 ->-| |
|______|\end{DoxyVerb}
< - > - !使用@code完全剥离引线,用\ verbatim和@verbatim替换为空格(加上一个额外的空格)。 DoxyCode环境定义为
\newenvironment{DoxyCode}{%
\par%
\scriptsize%
\begin{alltt}%
}{%
\end{alltt}%
\normalsize%
}
其中alltt在alltt包中定义:Automap 并且DoxyVerb定义为
\newenvironment{DoxyVerb}{%
\footnotesize%
\verbatim%
}{%
\endverbatim%
\normalsize%
}
请注意,逐字方法比@code(“\ scriptsize”)排版更大(“\ footnotesize”)。
非常感谢@ M24的帮助。