@@ -140,6 +140,100 @@ Sect2 paragraph.)md";
140140 EXPECT_EQ (kExpected , os.str ());
141141}
142142
143+ TEST (Doxygen2Markdown, DetailedDescription) {
144+ auto constexpr kXml = R"xml( <?xml version="1.0" standalone="yes"?>
145+ <doxygen version="1.9.1" xml:lang="en-US">
146+ <detaileddescription id='tested-node'>
147+ <sect1>
148+ <title>This is the title (1)</title>
149+ <para>First paragraph (1).</para>
150+ <para>Second paragraph (1).</para>
151+ <sect2><title>This is a section2</title><para>Sect2 paragraph.</para></sect2>
152+ </sect1>
153+ <sect1>
154+ <title>This is the title (2)</title>
155+ <para>First paragraph (2).</para>
156+ <para>Second paragraph (2).</para>
157+ </sect1>
158+ </detaileddescription>
159+ </doxygen>)xml" ;
160+
161+ auto constexpr kExpected = R"md(
162+
163+ ## This is the title (1)
164+
165+ First paragraph (1).
166+
167+ Second paragraph (1).
168+
169+ ### This is a section2
170+
171+ Sect2 paragraph.
172+
173+ ## This is the title (2)
174+
175+ First paragraph (2).
176+
177+ Second paragraph (2).)md" ;
178+ pugi::xml_document doc;
179+ doc.load_string (kXml );
180+ auto selected = doc.select_node (" //*[@id='tested-node']" );
181+ ASSERT_TRUE (selected);
182+ std::ostringstream os;
183+ ASSERT_TRUE (AppendIfDetailedDescription (os, {}, selected.node ()));
184+ EXPECT_EQ (kExpected , os.str ());
185+ }
186+
187+ TEST (Doxygen2Markdown, DetailedDescriptionSkipSect1) {
188+ auto constexpr kXml = R"xml( <?xml version="1.0" standalone="yes"?>
189+ <doxygen version="1.9.1" xml:lang="en-US">
190+ <detaileddescription id='tested-node'>
191+ <sect2>
192+ <title>This is the title (2)</title>
193+ <para>First paragraph (2).</para>
194+ <para>Second paragraph (2).</para>
195+ </sect2>
196+ <sect3>
197+ <title>This is the title (3)</title>
198+ <para>First paragraph (3).</para>
199+ <para>Second paragraph (3).</para>
200+ </sect3>
201+ <sect4>
202+ <title>This is the title (4)</title>
203+ <para>First paragraph (4).</para>
204+ <para>Second paragraph (4).</para>
205+ </sect4>
206+ </detaileddescription>
207+ </doxygen>)xml" ;
208+
209+ auto constexpr kExpected = R"md(
210+
211+ ### This is the title (2)
212+
213+ First paragraph (2).
214+
215+ Second paragraph (2).
216+
217+ #### This is the title (3)
218+
219+ First paragraph (3).
220+
221+ Second paragraph (3).
222+
223+ ##### This is the title (4)
224+
225+ First paragraph (4).
226+
227+ Second paragraph (4).)md" ;
228+ pugi::xml_document doc;
229+ doc.load_string (kXml );
230+ auto selected = doc.select_node (" //*[@id='tested-node']" );
231+ ASSERT_TRUE (selected);
232+ std::ostringstream os;
233+ ASSERT_TRUE (AppendIfDetailedDescription (os, {}, selected.node ()));
234+ EXPECT_EQ (kExpected , os.str ());
235+ }
236+
143237TEST (Doxygen2Markdown, PlainText) {
144238 pugi::xml_document doc;
145239 doc.load_string (R"xml( <?xml version="1.0" standalone="yes"?>
0 commit comments