diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-02-11 20:22:28 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-02-11 20:22:28 (GMT) |
commit | 0e080f486f67008ef427c834f6ab6ebca7578124 (patch) | |
tree | d817896b59922824cf9503fee329c26b7fa3cacd /src/htmlentity.cpp | |
parent | a28ff2331d8e228d901cd6f0b038f76e1cee630a (diff) | |
download | Doxygen-0e080f486f67008ef427c834f6ab6ebca7578124.zip Doxygen-0e080f486f67008ef427c834f6ab6ebca7578124.tar.gz Doxygen-0e080f486f67008ef427c834f6ab6ebca7578124.tar.bz2 |
Improved handling of percent symbol
Diffstat (limited to 'src/htmlentity.cpp')
-rw-r--r-- | src/htmlentity.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp index 7f07b57..c7ff1da 100644 --- a/src/htmlentity.cpp +++ b/src/htmlentity.cpp @@ -354,23 +354,41 @@ void HtmlEntityMapper::deleteInstance() /*! @brief Access routine to the UTF8 code of the HTML entity * * @param symb Code of the requested HTML entity + * @param useInPrintf If TRUE the result will be escaped such that it can be + * used in a printf string pattern * @return the UTF8 code of the HTML entity, * in case the UTF code is unknown \c NULL is returned. */ -const char *HtmlEntityMapper::utf8(DocSymbol::SymType symb) const +const char *HtmlEntityMapper::utf8(DocSymbol::SymType symb,bool useInPrintf) const { - return g_htmlEntities[symb].UTF8; + if (useInPrintf && symb==DocSymbol::Sym_Percent) + { + return "%%"; // escape for printf + } + else + { + return g_htmlEntities[symb].UTF8; + } } /*! @brief Access routine to the html code of the HTML entity * - * @param symb Code of the requested HTML entity - * @return the html of the HTML entity, + * @param symb Code of the requested HTML entity + * @param useInPrintf If TRUE the result will be escaped such that it can be + * used in a printf string pattern + * @return the html representation of the HTML entity, * in case the html code is unknown \c NULL is returned. */ -const char *HtmlEntityMapper::html(DocSymbol::SymType symb) const +const char *HtmlEntityMapper::html(DocSymbol::SymType symb,bool useInPrintf) const { - return g_htmlEntities[symb].html; + if (useInPrintf && symb==DocSymbol::Sym_Percent) + { + return "%%"; // escape for printf + } + else + { + return g_htmlEntities[symb].html; + } } /*! @brief Access routine to the XML code of the HTML entity |