added handling of HTML tags and HTML entities to PyDocConverter, updated tests
This commit is contained in:
parent
77b6099c05
commit
560dedb6c0
5 changed files with 454 additions and 30 deletions
|
|
@ -110,11 +110,11 @@ int func03(int a)
|
|||
* \f$ \sqrt{(x_2-x_1)^2+(y_2-y_1)^2} \f$
|
||||
*
|
||||
* \f[
|
||||
* \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
* \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
* \f]
|
||||
*
|
||||
* \f{
|
||||
* \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
* \sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
* \f}
|
||||
*
|
||||
* \file file.h
|
||||
|
|
@ -395,7 +395,7 @@ int func10(int a, float b)
|
|||
* \interface someInterface someHeader.h "Header name"
|
||||
*
|
||||
* Because of structural Doxygen command at the start of comment block,
|
||||
* the whoile comment block is ignored. See parser.y, f. isStructuralDoxygen()
|
||||
* the whole comment block is ignored. See parser.y, f. isStructuralDoxygen()
|
||||
* or documentation for the list of commands.
|
||||
*/
|
||||
int func11(int a, float b)
|
||||
|
|
|
|||
|
|
@ -91,14 +91,31 @@ commentVerifier.check(doxygen_translate_all_tags.func04.__doc__,
|
|||
r"""
|
||||
Throws: SuperError
|
||||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
|
||||
|
||||
\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
This will only appear in hmtl
|
||||
""")
|
||||
|
||||
""")
|
||||
|
||||
commentVerifier.check(doxygen_translate_all_tags.func05.__doc__,
|
||||
r"""
|
||||
|
|
@ -122,29 +139,68 @@ r"""
|
|||
|
||||
Image: testImage.bmp("Hello, world!")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Some text
|
||||
describing invariant.
|
||||
""")
|
||||
""")
|
||||
|
||||
commentVerifier.check(doxygen_translate_all_tags.func06.__doc__,
|
||||
r"""
|
||||
Comment for __func06().__
|
||||
|
||||
|
||||
|
||||
|
||||
This will only appear in LATeX
|
||||
|
||||
|
||||
|
||||
|
||||
-Some unordered list
|
||||
-With lots of items
|
||||
-lots of lots of items
|
||||
|
||||
|
||||
|
||||
someMember Some description follows
|
||||
|
||||
someMember Some description follows
|
||||
|
||||
|
||||
|
||||
|
||||
This will only appear in man
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
""")
|
||||
|
||||
commentVerifier.check(doxygen_translate_all_tags.func07.__doc__,
|
||||
r"""
|
||||
Comment for __func07().__
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Notes: Here
|
||||
is the note!
|
||||
|
||||
|
|
@ -153,18 +209,28 @@ r"""
|
|||
|
||||
someword
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Title: The paragraph title
|
||||
The paragraph text.
|
||||
Maybe even multiline
|
||||
|
||||
|
||||
|
||||
Arguments:
|
||||
a (int) -- the first param
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
""")
|
||||
|
||||
commentVerifier.check(doxygen_translate_all_tags.func08.__doc__,
|
||||
r"""
|
||||
Remarks:
|
||||
Some remark text
|
||||
Remarks: Some remark text
|
||||
|
||||
Another remarks section
|
||||
|
||||
|
|
@ -172,8 +238,9 @@ r"""
|
|||
|
||||
it
|
||||
|
||||
may return
|
||||
""")
|
||||
Returns: may return
|
||||
|
||||
""")
|
||||
|
||||
commentVerifier.check(doxygen_translate_all_tags.func09.__doc__,
|
||||
r"""
|
||||
|
|
@ -182,37 +249,67 @@ r"""
|
|||
|
||||
See also: someOtherMethod
|
||||
|
||||
|
||||
|
||||
function
|
||||
|
||||
Same as
|
||||
brief description
|
||||
|
||||
|
||||
|
||||
Since: version 0.0.0.1
|
||||
|
||||
Throws: superException
|
||||
|
||||
RuntimeError
|
||||
""")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Throw: superException
|
||||
|
||||
Throws: RuntimeError
|
||||
""")
|
||||
|
||||
commentVerifier.check(doxygen_translate_all_tags.func10.__doc__,
|
||||
r"""
|
||||
TODO:
|
||||
Some very important task
|
||||
TODO: Some very important task
|
||||
|
||||
Arguments:
|
||||
b (float) -- B is mentioned again...
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
very long
|
||||
text with tags <sometag>
|
||||
|
||||
|
||||
|
||||
|
||||
Version: 0.0.0.2
|
||||
|
||||
Warning: This is senseless!
|
||||
|
||||
|
||||
|
||||
|
||||
This will only appear in XML
|
||||
|
||||
|
||||
Here goes test of symbols:
|
||||
$ @ \ & ~ < > # % " . ::
|
||||
|
||||
And here goes simple text
|
||||
""")
|
||||
""")
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ r"""
|
|||
|
||||
See also: someOtherMethod
|
||||
|
||||
function
|
||||
See also: function
|
||||
|
||||
Since: version 0.0.0.1
|
||||
|
||||
|
|
@ -131,3 +131,120 @@ r"""
|
|||
And here goes simple text
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
|
||||
commentVerifier.check(doxygen_translate.htmlFunction.__doc__,
|
||||
r"""
|
||||
Test for html tags. See Doxygen doc for list of tags recognized by Doxygen.
|
||||
|
||||
<a href = "http://acme.com/index.html">This is link</a>
|
||||
<b>bold</b>
|
||||
<BLOCKQUOTE>
|
||||
Quotation block.
|
||||
</BLOCKQUOTE>
|
||||
<br>
|
||||
<center>center</center>
|
||||
<code>this is code</code>
|
||||
<DD> Starts an item description.
|
||||
<DFN> Starts a piece of text displayed in a typewriter font.
|
||||
</DFN>
|
||||
<DIV> Starts a section with a specific style (HTML only)
|
||||
</DIV>
|
||||
<DL> Starts a description list.
|
||||
<DT> Starts an item title.</DT>
|
||||
</DL>
|
||||
<EM> Starts a piece of text displayed in an italic font.
|
||||
</EM>
|
||||
<FORM> 'Form' does not generate any output.
|
||||
</FORM>
|
||||
<HR>
|
||||
<H1> Starts an unnumbered section.
|
||||
</H1>
|
||||
<H2> Starts an unnumbered subsection.
|
||||
</H2>
|
||||
<H3> Starts an unnumbered subsubsection.
|
||||
</H3>
|
||||
<I> Starts a piece of text displayed in an italic font.
|
||||
<INPUT> Does not generate any output.
|
||||
</I>
|
||||
<IMG src="slika.png">
|
||||
<META> Does not generate any output.
|
||||
<MULTICOL> ignored by doxygen.
|
||||
</MULTICOL> ignored by doxygen.
|
||||
|
||||
<OL> Starts a numbered item list.
|
||||
<LI> Starts a new list item.
|
||||
</LI>
|
||||
</OL> Ends a numbered item list.
|
||||
|
||||
<P> Starts a new paragraph.
|
||||
</P>
|
||||
<PRE> Starts a preformatted fragment.
|
||||
</PRE>
|
||||
<SMALL> Starts a section of text displayed in a smaller font.
|
||||
</SMALL>
|
||||
<SPAN> Starts an inline text fragment with a specific style (HTML only)
|
||||
</SPAN>
|
||||
<STRONG> Starts a section of bold text.
|
||||
</STRONG>
|
||||
<SUB> Starts a piece of text displayed in subscript.
|
||||
</SUB>
|
||||
<SUP> Starts a piece of text displayed in superscript.
|
||||
</SUP>
|
||||
|
||||
<table border = '1'>
|
||||
<caption>Animals</caption>
|
||||
<tr><th> cow </th><th> dog </th></tr>
|
||||
<tr><td> cow </td><td> dog </td></tr>
|
||||
<tr><td> cat </td><td> mouse </td></tr>
|
||||
<tr><td> horse </td><td> parrot </td></tr>
|
||||
</table>
|
||||
|
||||
<TT> Starts a piece of text displayed in a typewriter font.
|
||||
</TT>
|
||||
<KBD> Starts a piece of text displayed in a typewriter font.
|
||||
</KBD>
|
||||
|
||||
<UL> Starts an unnumbered item list.
|
||||
<LI> Starts a new list item 1.</LI>
|
||||
<LI> Starts a new list item 2.</LI>
|
||||
<LI> Starts a new list item 3.</LI>
|
||||
</UL> Ends an unnumbered item list.
|
||||
|
||||
<VAR> Starts a piece of text displayed in an italic font.
|
||||
</VAR>
|
||||
|
||||
\htmlonly
|
||||
<u>underlined \b bold text - doxy commands are ignored inside 'htmlonly' section </u>
|
||||
\endhtmlonly
|
||||
<u>underlined text</u>
|
||||
""")
|
||||
|
||||
|
||||
commentVerifier.check(doxygen_translate.htmlEntitiesFunction.__doc__,
|
||||
r"""
|
||||
All entities are treated as commands (C); TM (R);
|
||||
should work also<in text
|
||||
>
|
||||
&
|
||||
'
|
||||
"
|
||||
'
|
||||
'
|
||||
"
|
||||
"
|
||||
-
|
||||
--
|
||||
|
||||
x
|
||||
-
|
||||
.
|
||||
~
|
||||
<=
|
||||
>=
|
||||
<--
|
||||
-->
|
||||
Not an html entity - ignored by Doxygen.
|
||||
Not an &text html entity - ampersand is replaced with entity.
|
||||
""")
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ void PyDocConverter::fillStaticTables() {
|
|||
sectionTitles["result"] = "Return: ";
|
||||
sectionTitles["return"] = "Return: ";
|
||||
sectionTitles["returns"] = "Returns: ";
|
||||
sectionTitles["sa"] = "See also: ";
|
||||
sectionTitles["see"] = "See also: ";
|
||||
// sectionTitles["sa"] = "See also: ";
|
||||
// sectionTitles["see"] = "See also: ";
|
||||
sectionTitles["since"] = "Since: ";
|
||||
sectionTitles["throw"] = "Throw: ";
|
||||
sectionTitles["throws"] = "Throws: ";
|
||||
|
|
@ -57,7 +57,7 @@ void PyDocConverter::fillStaticTables() {
|
|||
tagHandlers["a"] = make_pair(&PyDocConverter::handleTagWrap, "_");
|
||||
tagHandlers["b"] = make_pair(&PyDocConverter::handleTagWrap, "__");
|
||||
// \c command is translated as single quotes around next word
|
||||
tagHandlers["c"] = make_pair(&PyDocConverter::handleTagWrap, "'");
|
||||
tagHandlers["c"] = make_pair(&PyDocConverter::handleTagWrap, "'"); // see markdown support in doxy, section 'code wraps'
|
||||
tagHandlers["cite"] = make_pair(&PyDocConverter::handleTagWrap, "'");
|
||||
tagHandlers["e"] = make_pair(&PyDocConverter::handleTagWrap, "_");
|
||||
// these commands insert just a single char, some of them need to be escaped
|
||||
|
|
@ -101,8 +101,8 @@ void PyDocConverter::fillStaticTables() {
|
|||
tagHandlers["result"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
tagHandlers["remark"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
tagHandlers["remarks"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
tagHandlers["sa"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
tagHandlers["see"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
tagHandlers["sa"] = make_pair(&PyDocConverter::handleTagMessage, "See also: ");
|
||||
tagHandlers["see"] = make_pair(&PyDocConverter::handleTagMessage, "See also: ");
|
||||
tagHandlers["since"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
tagHandlers["short"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
tagHandlers["throw"] = make_pair(&PyDocConverter::handleParagraph, "");
|
||||
|
|
@ -133,10 +133,87 @@ void PyDocConverter::fillStaticTables() {
|
|||
tagHandlers["plainstd::string"] = make_pair(&PyDocConverter::handlePlainString, "");
|
||||
tagHandlers["plainstd::endl"] = make_pair(&PyDocConverter::handleNewLine, "");
|
||||
tagHandlers["n"] = make_pair(&PyDocConverter::handleNewLine, "");
|
||||
|
||||
// \f commands output literal Latex formula, which is still better than nothing.
|
||||
tagHandlers["f$"] = make_pair(&PyDocConverter::handleTagVerbatim, "");
|
||||
tagHandlers["f["] = make_pair(&PyDocConverter::handleTagVerbatim, "");
|
||||
tagHandlers["f{"] = make_pair(&PyDocConverter::handleTagVerbatim, "");
|
||||
|
||||
// HTML tags
|
||||
tagHandlers["<a" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<b" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag2, "__");
|
||||
tagHandlers["<blockquote"] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "");
|
||||
tagHandlers["<body" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<br" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "\n" );
|
||||
tagHandlers["<center" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<caption"] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "");
|
||||
tagHandlers["<code" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<dd" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<dfn" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<div" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<dl" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<dt" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<em" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag2, "_");
|
||||
tagHandlers["<form" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<hr" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag,
|
||||
"--------------------------------------------------------------------\n" );
|
||||
tagHandlers["<h1" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "# " );
|
||||
tagHandlers["<h2" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "##" );
|
||||
tagHandlers["<h3" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "###" );
|
||||
tagHandlers["<i" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag2, "_");
|
||||
tagHandlers["<input" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<img" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "Image:" );
|
||||
tagHandlers["<li" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "- " );
|
||||
tagHandlers["<meta" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<multicol"] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "");
|
||||
tagHandlers["<ol" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<p" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "\n\n" );
|
||||
tagHandlers["<pre" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<small" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<span" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<strong" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag2, "__");
|
||||
tagHandlers["<sub" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<sup" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<table" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "" );
|
||||
tagHandlers["<td" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag_td, "");
|
||||
tagHandlers["<th" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag_th, "");
|
||||
tagHandlers["<tr" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag_tr, "");
|
||||
tagHandlers["<tt" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "");
|
||||
tagHandlers["<kbd" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "");
|
||||
tagHandlers["<ul" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag, "");
|
||||
tagHandlers["<var" ] = make_pair(&PyDocConverter::handleDoxyHtmlTag2, "_");
|
||||
|
||||
// HTML entities
|
||||
tagHandlers["©" ] = make_pair(&PyDocConverter::handleHtmlEntity, "(C)");
|
||||
tagHandlers["&trade"] = make_pair(&PyDocConverter::handleHtmlEntity, " TM");
|
||||
tagHandlers["®" ] = make_pair(&PyDocConverter::handleHtmlEntity, "(R)");
|
||||
tagHandlers["<" ] = make_pair(&PyDocConverter::handleHtmlEntity, "<");
|
||||
tagHandlers[">" ] = make_pair(&PyDocConverter::handleHtmlEntity, ">");
|
||||
tagHandlers["&" ] = make_pair(&PyDocConverter::handleHtmlEntity, "&");
|
||||
tagHandlers["&apos" ] = make_pair(&PyDocConverter::handleHtmlEntity, "'");
|
||||
tagHandlers[""" ] = make_pair(&PyDocConverter::handleHtmlEntity, "\"");
|
||||
tagHandlers["&lsquo"] = make_pair(&PyDocConverter::handleHtmlEntity, "`");
|
||||
tagHandlers["&rsquo"] = make_pair(&PyDocConverter::handleHtmlEntity, "'");
|
||||
tagHandlers["&ldquo"] = make_pair(&PyDocConverter::handleHtmlEntity, "\"");
|
||||
tagHandlers["&rdquo"] = make_pair(&PyDocConverter::handleHtmlEntity, "\"");
|
||||
tagHandlers["&ndash"] = make_pair(&PyDocConverter::handleHtmlEntity, "-");
|
||||
tagHandlers["&mdash"] = make_pair(&PyDocConverter::handleHtmlEntity, "--");
|
||||
tagHandlers[" " ] = make_pair(&PyDocConverter::handleHtmlEntity, " ");
|
||||
tagHandlers["×"] = make_pair(&PyDocConverter::handleHtmlEntity, "x");
|
||||
tagHandlers["&minus"] = make_pair(&PyDocConverter::handleHtmlEntity, "-");
|
||||
tagHandlers["&sdot" ] = make_pair(&PyDocConverter::handleHtmlEntity, ".");
|
||||
tagHandlers["&sim" ] = make_pair(&PyDocConverter::handleHtmlEntity, "~");
|
||||
tagHandlers["&le" ] = make_pair(&PyDocConverter::handleHtmlEntity, "<=");
|
||||
tagHandlers["&ge" ] = make_pair(&PyDocConverter::handleHtmlEntity, ">=");
|
||||
tagHandlers["&larr" ] = make_pair(&PyDocConverter::handleHtmlEntity, "<--");
|
||||
tagHandlers["&rarr" ] = make_pair(&PyDocConverter::handleHtmlEntity, "-->");
|
||||
}
|
||||
|
||||
PyDocConverter::PyDocConverter(bool debugTranslator, bool debugParser)
|
||||
: DoxygenTranslator(debugTranslator, debugParser) {
|
||||
: DoxygenTranslator(debugTranslator, debugParser),
|
||||
m_tableLineLen(0),
|
||||
m_prevRowIsTH(false)
|
||||
{
|
||||
fillStaticTables();
|
||||
}
|
||||
|
||||
|
|
@ -228,6 +305,16 @@ void PyDocConverter::handlePlainString(DoxygenEntity& tag, std::string& translat
|
|||
}
|
||||
|
||||
|
||||
void PyDocConverter::handleTagVerbatim(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &arg) {
|
||||
translatedComment += arg + " ";
|
||||
for (DoxygenEntityListCIt it = tag.entityList.begin(); it != tag.entityList.end(); it++) {
|
||||
translatedComment += it->data;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PyDocConverter::handleTagMessage(DoxygenEntity& tag, std::string& translatedComment, std::string &arg) {
|
||||
std::string dummy;
|
||||
translatedComment += arg;
|
||||
|
|
@ -305,6 +392,89 @@ void PyDocConverter::handleTagWrap(DoxygenEntity& tag, std::string& translatedCo
|
|||
}
|
||||
|
||||
|
||||
void PyDocConverter::handleDoxyHtmlTag(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &arg) {
|
||||
std::string htmlTagArgs = tag.data;
|
||||
if (htmlTagArgs == "/") {
|
||||
// end html tag, for example "</ul>
|
||||
// translatedComment += "</" + arg.substr(1) + ">";
|
||||
} else {
|
||||
translatedComment += arg + htmlTagArgs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PyDocConverter::handleDoxyHtmlTag2(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &arg) {
|
||||
std::string htmlTagArgs = tag.data;
|
||||
if (htmlTagArgs == "/") {
|
||||
// end html tag, for example "</em>
|
||||
translatedComment += arg;
|
||||
} else {
|
||||
translatedComment += arg;
|
||||
}
|
||||
}
|
||||
|
||||
void PyDocConverter::handleDoxyHtmlTag_tr(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &) {
|
||||
std::string htmlTagArgs = tag.data;
|
||||
if (htmlTagArgs == "/") {
|
||||
// end tag, </tr> appends vertical table line '|'
|
||||
translatedComment += '|';
|
||||
size_t nlPos = translatedComment.rfind('\n');
|
||||
if (nlPos != string::npos) {
|
||||
size_t startOfTableLinePos = translatedComment.find_first_not_of(" \t", nlPos);
|
||||
if (startOfTableLinePos != string::npos) {
|
||||
m_tableLineLen = translatedComment.size() - startOfTableLinePos;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (m_prevRowIsTH) {
|
||||
// if previous row contained <th> tag, add horizontal separator
|
||||
translatedComment += string('_', m_tableLineLen);
|
||||
m_prevRowIsTH = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PyDocConverter::handleDoxyHtmlTag_th(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &) {
|
||||
std::string htmlTagArgs = tag.data;
|
||||
if (htmlTagArgs == "/") {
|
||||
// end tag, </th> is ignored
|
||||
} else {
|
||||
translatedComment += '|';
|
||||
m_prevRowIsTH = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PyDocConverter::handleDoxyHtmlTag_td(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &) {
|
||||
std::string htmlTagArgs = tag.data;
|
||||
if (htmlTagArgs == "/") {
|
||||
// end tag, </td> is ignored
|
||||
} else {
|
||||
translatedComment += '|';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PyDocConverter::handleHtmlEntity(DoxygenEntity&,
|
||||
std::string& translatedComment,
|
||||
std::string &arg) {
|
||||
// html entities
|
||||
translatedComment += arg;
|
||||
}
|
||||
|
||||
|
||||
void PyDocConverter::handleNewLine(DoxygenEntity&, std::string& translatedComment, std::string&) {
|
||||
translatedComment += "\n";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@ public:
|
|||
String *makeDocumentation(Node *node);
|
||||
|
||||
protected:
|
||||
|
||||
size_t m_tableLineLen;
|
||||
bool m_prevRowIsTH;
|
||||
|
||||
/*
|
||||
* Format a string so it is justified and split over several lines
|
||||
* not exeeding a given length.
|
||||
|
|
@ -74,6 +78,14 @@ protected:
|
|||
* Print only data part of code
|
||||
*/
|
||||
void handlePlainString(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
|
||||
|
||||
/**
|
||||
* Copies verbatim args of the tag to output, used for commands like \f$, ...
|
||||
*/
|
||||
void handleTagVerbatim(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &arg);
|
||||
|
||||
/*
|
||||
* Print the if-elseif-else-endif section
|
||||
*/
|
||||
|
|
@ -96,6 +108,34 @@ protected:
|
|||
*/
|
||||
void handleTagParam(DoxygenEntity &tag, std::string &translatedComment, std::string &arg);
|
||||
|
||||
/* Handles HTML tags recognized by Doxygen, like <A ...>, <ul>, <table>, ... */
|
||||
|
||||
void handleDoxyHtmlTag(DoxygenEntity& tag, std::string& translatedComment, std::string &arg);
|
||||
|
||||
/*
|
||||
* Handles HTML tags, which are translated to markdown-like syntax, for example
|
||||
* <i>text</i> --> _text_. Appends arg for start HTML tag and end HTML tag.
|
||||
*/
|
||||
void handleDoxyHtmlTag2(DoxygenEntity& tag,
|
||||
std::string& translatedComment,
|
||||
std::string &arg);
|
||||
|
||||
/* Handles HTML table, tag <tr> */
|
||||
void handleDoxyHtmlTag_tr(DoxygenEntity& tag, std::string& translatedComment,
|
||||
std::string &arg);
|
||||
|
||||
/* Handles HTML table, tag <th> */
|
||||
void handleDoxyHtmlTag_th(DoxygenEntity& tag, std::string& translatedComment,
|
||||
std::string &arg);
|
||||
|
||||
/* Handles HTML table, tag <td> */
|
||||
void handleDoxyHtmlTag_td(DoxygenEntity& tag, std::string& translatedComment,
|
||||
std::string &arg);
|
||||
|
||||
/* Handles HTML entities recognized by Doxygen, like <, ©, ... */
|
||||
void handleHtmlEntity(DoxygenEntity&, std::string& translatedComment, std::string &arg);
|
||||
|
||||
|
||||
/*
|
||||
* Utility method to generate a diving line for a documentation string.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue