diff --git a/Examples/test-suite/doxygen_translate.i b/Examples/test-suite/doxygen_translate.i index 8bfd3d250..6af66f0b1 100644 --- a/Examples/test-suite/doxygen_translate.i +++ b/Examples/test-suite/doxygen_translate.i @@ -125,4 +125,90 @@ int function(int a, float b) { } +/** + * Test for html tags. See Doxygen doc for list of tags recognized by Doxygen. + * + * This is link + * bold + *
+ * Quotation block. + *
+ *
+ *
center
+ * this is code + *
Starts an item description. + * Starts a piece of text displayed in a typewriter font. + * + *
Starts a section with a specific style (HTML only) + *
+ *
Starts a description list. + *
Starts an item title.
+ *
+ * Starts a piece of text displayed in an italic font. + * + *
'Form' does not generate any output. + *
+ *
+ *

Starts an unnumbered section. + *

+ *

Starts an unnumbered subsection. + *

+ *

Starts an unnumbered subsubsection. + *

+ * Starts a piece of text displayed in an italic font. + * Does not generate any output. + * + * + * Does not generate any output. + * ignored by doxygen. + * ignored by doxygen. + * + *
    Starts a numbered item list. + *
  1. Starts a new list item. + *
  2. + *
Ends a numbered item list. + * + *

Starts a new paragraph. + *

+ *
 Starts a preformatted fragment.
+ * 
+ * Starts a section of text displayed in a smaller font. + * + * Starts an inline text fragment with a specific style (HTML only) + * + * Starts a section of bold text. + * + * Starts a piece of text displayed in subscript. + * + * Starts a piece of text displayed in superscript. + * + * + * + * + * + * + * + * + *
Animals
cow dog
cow dog
cat mouse
horse parrot
+ * + * Starts a piece of text displayed in a typewriter font. + * + * Starts a piece of text displayed in a typewriter font. + * + * + * Ends an unnumbered item list. + * + * Starts a piece of text displayed in an italic font. + * + */ +int htmlFunction(int a, float b) +{ +} + + + %} diff --git a/Examples/test-suite/java/doxygen_translate_runme.java b/Examples/test-suite/java/doxygen_translate_runme.java index 55342ef55..40830a2f6 100644 --- a/Examples/test-suite/java/doxygen_translate_runme.java +++ b/Examples/test-suite/java/doxygen_translate_runme.java @@ -146,6 +146,87 @@ public class doxygen_translate_runme { " And here goes simple text \n" + " \n" + ""); + + wantedComments.put("doxygen_translate.doxygen_translate.htmlFunction(int, float)", + " Test for html tags. See Doxygen doc for list of tags recognized by Doxygen. \n" + + " \n" + + " This is link \n" + + " bold \n" + + "
\n" + + " Quotation block. \n" + + "
\n" + + "
\n" + + "
center
\n" + + " this is code \n" + + "
Starts an item description. \n" + + " Starts a piece of text displayed in a typewriter font. \n" + + " \n" + + "
Starts a section with a specific style (HTML only) \n" + + "
\n" + + "
Starts a description list. \n" + + "
Starts an item title.
\n" + + "
\n" + + " Starts a piece of text displayed in an italic font. \n" + + " \n" + + "
'Form' does not generate any output. \n" + + "
\n" + + "
\n" + + "

Starts an unnumbered section. \n" + + "

\n" + + "

Starts an unnumbered subsection. \n" + + "

\n" + + "

Starts an unnumbered subsubsection. \n" + + "

\n" + + " Starts a piece of text displayed in an italic font. \n" + + " Does not generate any output. \n" + + " \n" + + " \n" + + " Does not generate any output. \n" + + " ignored by doxygen. \n" + + " ignored by doxygen. \n" + + " \n" + + "
    Starts a numbered item list. \n" + + "
  1. Starts a new list item. \n" + + "
  2. \n" + + "
Ends a numbered item list. \n" + + " \n" + + "

Starts a new paragraph. \n" + + "

\n" + + "
 Starts a preformatted fragment.                                                \n" +
+    		" 
\n" + + " Starts a section of text displayed in a smaller font. \n" + + " \n" + + " Starts an inline text fragment with a specific style (HTML only) \n" + + " \n" + + " Starts a section of bold text. \n" + + " \n" + + " Starts a piece of text displayed in subscript. \n" + + " \n" + + " Starts a piece of text displayed in superscript. \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + "
Animals
cow dog
cow dog
cat mouse
horse parrot
\n" + + " \n" + + " Starts a piece of text displayed in a typewriter font. \n" + + " \n" + + " Starts a piece of text displayed in a typewriter font. \n" + + " \n" + + " \n" + + " Ends an unnumbered item list. \n" + + " \n" + + " Starts a piece of text displayed in an italic font. \n" + + " \n" + + ""); // and ask the parser to check comments for us System.exit(parser.check(wantedComments)); } diff --git a/Source/DoxygenTranslator/src/DoxygenCommands.h b/Source/DoxygenTranslator/src/DoxygenCommands.h index eb5f5d39f..029c47550 100644 --- a/Source/DoxygenTranslator/src/DoxygenCommands.h +++ b/Source/DoxygenTranslator/src/DoxygenCommands.h @@ -85,7 +85,7 @@ const int commandUniquesSize = sizeof(commandUniques) / sizeof(*commandUniques); // behavior must be repeated by SWIG. See Doxygen doc for the list of commands. // '<' is prepended to distinguish HTML tags from Doxygen commands. const char *commandHtml[] = { - "m_tokenType == PLAINSTRING) { + return (m_tokenListIt++)->m_tokenString; + } + + return ""; +} + + + std::string DoxygenParser::getNextWord() { /* if (m_tokenListIt == m_tokenList.end()) { @@ -582,7 +597,7 @@ int DoxygenParser::addCommandHtml(const std::string &theCommand, if (noisy) cout << "Parsing " << theCommand << endl; - std::string htmlTagArgs = getNextWord(); + std::string htmlTagArgs = getNextToken(); doxyList.push_back(DoxygenEntity(theCommand, htmlTagArgs)); return 1; } @@ -1201,7 +1216,7 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) pos++; } - size_t endHtmlPos = line.find_first_of("\t\n >", pos); + size_t endHtmlPos = line.find_first_of("\t >", pos); // prepend '<' to distinguish HTML tags from doxygen commands string cmd = line.substr(pos, endHtmlPos - pos); @@ -1223,6 +1238,7 @@ size_t DoxygenParser::processNormalComment(size_t pos, const std::string &line) // add args of HTML command, like link URL, image URL, ... m_tokenList.push_back(Token(PLAINSTRING, line.substr(pos, endHtmlPos - pos))); + pos = endHtmlPos; } else { if (isEndHtmlTag) { // it is a simple tag, so push empty string diff --git a/Source/DoxygenTranslator/src/DoxygenParser.h b/Source/DoxygenTranslator/src/DoxygenParser.h index 3417a59f4..558a85ef3 100644 --- a/Source/DoxygenTranslator/src/DoxygenParser.h +++ b/Source/DoxygenTranslator/src/DoxygenParser.h @@ -140,6 +140,12 @@ private: */ std::string trim(const std::string &text); + /* + * Returns string of the next token if the next token is PLAINSTRING. Returns + * empty string otherwise. + */ + std::string getNextToken(); + /* * Returns the next word ON THE CURRENT LINE ONLY * if a new line is encountered, returns a blank std::string. diff --git a/Source/DoxygenTranslator/src/JavaDocConverter.cpp b/Source/DoxygenTranslator/src/JavaDocConverter.cpp index bd592adc2..d070bbdad 100644 --- a/Source/DoxygenTranslator/src/JavaDocConverter.cpp +++ b/Source/DoxygenTranslator/src/JavaDocConverter.cpp @@ -152,8 +152,47 @@ void JavaDocConverter::fillStaticTables() { tagHandlers["n"] = make_pair(&JavaDocConverter::handleNewLine, ""); // HTML tags - tagHandlers["