Blame doxygen-percent_sign.patch

Than Ngo 505fc8
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
Than Ngo 505fc8
index c748162..526ed49 100644
Than Ngo 505fc8
--- a/src/docbookvisitor.cpp
Than Ngo 505fc8
+++ b/src/docbookvisitor.cpp
Than Ngo 505fc8
@@ -81,7 +81,7 @@ void DocbookDocVisitor::visit(DocSymbol *s)
Than Ngo 505fc8
   }
Than Ngo 505fc8
   else
Than Ngo 505fc8
   {
Than Ngo 505fc8
-    err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
Than Ngo 505fc8
+    err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
Than Ngo 505fc8
   }
Than Ngo 505fc8
 }
Than Ngo 505fc8
 
Than Ngo 505fc8
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
Than Ngo 505fc8
index 647007b..f6878b9 100644
Than Ngo 505fc8
--- a/src/htmldocvisitor.cpp
Than Ngo 505fc8
+++ b/src/htmldocvisitor.cpp
Than Ngo 505fc8
@@ -190,7 +190,7 @@ void HtmlDocVisitor::visit(DocSymbol *s)
Than Ngo 505fc8
   }
Than Ngo 505fc8
   else
Than Ngo 505fc8
   {
Than Ngo 505fc8
-    err("HTML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
Than Ngo 505fc8
+    err("HTML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
Than Ngo 505fc8
   }
Than Ngo 505fc8
 }
Than Ngo 505fc8
 
Than Ngo 505fc8
diff --git a/src/htmlentity.cpp b/src/htmlentity.cpp
Than Ngo 505fc8
index 7f07b57..c7ff1da 100644
Than Ngo 505fc8
--- a/src/htmlentity.cpp
Than Ngo 505fc8
+++ b/src/htmlentity.cpp
Than Ngo 505fc8
@@ -354,23 +354,41 @@ void HtmlEntityMapper::deleteInstance()
Than Ngo 505fc8
 /*! @brief Access routine to the UTF8 code of the HTML entity
Than Ngo 505fc8
  *
Than Ngo 505fc8
  * @param symb Code of the requested HTML entity
Than Ngo 505fc8
+ * @param useInPrintf If TRUE the result will be escaped such that it can be
Than Ngo 505fc8
+ *                    used in a printf string pattern
Than Ngo 505fc8
  * @return the UTF8 code of the HTML entity,
Than Ngo 505fc8
  *         in case the UTF code is unknown \c NULL is returned.
Than Ngo 505fc8
  */
Than Ngo 505fc8
-const char *HtmlEntityMapper::utf8(DocSymbol::SymType symb) const
Than Ngo 505fc8
+const char *HtmlEntityMapper::utf8(DocSymbol::SymType symb,bool useInPrintf) const
Than Ngo 505fc8
 {
Than Ngo 505fc8
-  return g_htmlEntities[symb].UTF8;
Than Ngo 505fc8
+  if (useInPrintf && symb==DocSymbol::Sym_Percent)
Than Ngo 505fc8
+  {
Than Ngo 505fc8
+    return "%%"; // escape for printf
Than Ngo 505fc8
+  }
Than Ngo 505fc8
+  else
Than Ngo 505fc8
+  {
Than Ngo 505fc8
+    return g_htmlEntities[symb].UTF8;
Than Ngo 505fc8
+  }
Than Ngo 505fc8
 }
Than Ngo 505fc8
 
Than Ngo 505fc8
 /*! @brief Access routine to the html code of the HTML entity
Than Ngo 505fc8
  *
Than Ngo 505fc8
- * @param symb Code of the requested HTML entity
Than Ngo 505fc8
- * @return the html of the HTML entity,
Than Ngo 505fc8
+ * @param symb        Code of the requested HTML entity
Than Ngo 505fc8
+ * @param useInPrintf If TRUE the result will be escaped such that it can be
Than Ngo 505fc8
+ *                    used in a printf string pattern
Than Ngo 505fc8
+ * @return the html representation of the HTML entity,
Than Ngo 505fc8
  *         in case the html code is unknown \c NULL is returned.
Than Ngo 505fc8
  */
Than Ngo 505fc8
-const char *HtmlEntityMapper::html(DocSymbol::SymType symb) const
Than Ngo 505fc8
+const char *HtmlEntityMapper::html(DocSymbol::SymType symb,bool useInPrintf) const
Than Ngo 505fc8
 {
Than Ngo 505fc8
-  return g_htmlEntities[symb].html;
Than Ngo 505fc8
+  if (useInPrintf && symb==DocSymbol::Sym_Percent)
Than Ngo 505fc8
+  {
Than Ngo 505fc8
+    return "%%"; // escape for printf
Than Ngo 505fc8
+  }
Than Ngo 505fc8
+  else
Than Ngo 505fc8
+  {
Than Ngo 505fc8
+    return g_htmlEntities[symb].html;
Than Ngo 505fc8
+  }
Than Ngo 505fc8
 }
Than Ngo 505fc8
 
Than Ngo 505fc8
 /*! @brief Access routine to the XML code of the HTML entity
Than Ngo 505fc8
diff --git a/src/htmlentity.h b/src/htmlentity.h
Than Ngo 505fc8
index b92eb1d..9cebeb3 100644
Than Ngo 505fc8
--- a/src/htmlentity.h
Than Ngo 505fc8
+++ b/src/htmlentity.h
Than Ngo 505fc8
@@ -27,8 +27,8 @@ class HtmlEntityMapper
Than Ngo 505fc8
     static HtmlEntityMapper *instance();
Than Ngo 505fc8
     static void deleteInstance();
Than Ngo 505fc8
     DocSymbol::SymType name2sym(const QCString &symName) const;
Than Ngo 505fc8
-    const char *utf8(DocSymbol::SymType symb) const;
Than Ngo 505fc8
-    const char *html(DocSymbol::SymType symb) const;
Than Ngo 505fc8
+    const char *utf8(DocSymbol::SymType symb,bool useInPrintf=FALSE) const;
Than Ngo 505fc8
+    const char *html(DocSymbol::SymType symb,bool useInPrintf=FALSE) const;
Than Ngo 505fc8
     const char *xml(DocSymbol::SymType symb) const;
Than Ngo 505fc8
     const char *docbook(DocSymbol::SymType symb) const;
Than Ngo 505fc8
     const char *latex(DocSymbol::SymType symb) const;
Than Ngo 505fc8
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
Than Ngo 505fc8
index c2c884b..aefcac3 100644
Than Ngo 505fc8
--- a/src/latexdocvisitor.cpp
Than Ngo 505fc8
+++ b/src/latexdocvisitor.cpp
Than Ngo 505fc8
@@ -154,7 +154,7 @@ void LatexDocVisitor::visit(DocSymbol *s)
Than Ngo 505fc8
   }
Than Ngo 505fc8
   else
Than Ngo 505fc8
   {
Than Ngo 505fc8
-    err("LaTeX: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
Than Ngo 505fc8
+    err("LaTeX: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
Than Ngo 505fc8
   }
Than Ngo 505fc8
 }
Than Ngo 505fc8
 
Than Ngo 505fc8
diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp
Than Ngo 505fc8
index 276313c..7fa0153 100644
Than Ngo 505fc8
--- a/src/perlmodgen.cpp
Than Ngo 505fc8
+++ b/src/perlmodgen.cpp
Than Ngo 505fc8
@@ -606,7 +606,7 @@ void PerlModDocVisitor::visit(DocSymbol *sy)
Than Ngo 505fc8
   }
Than Ngo 505fc8
   else
Than Ngo 505fc8
   {
Than Ngo 505fc8
-    err("perl: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(sy->symbol()));
Than Ngo 505fc8
+    err("perl: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(sy->symbol(),TRUE));
Than Ngo 505fc8
   }
Than Ngo 505fc8
 }
Than Ngo 505fc8
 
Than Ngo 505fc8
diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h
Than Ngo 505fc8
index 7a077e9..ee4104e 100644
Than Ngo 505fc8
--- a/src/printdocvisitor.h
Than Ngo 505fc8
+++ b/src/printdocvisitor.h
Than Ngo 505fc8
@@ -57,21 +57,14 @@ class PrintDocVisitor : public DocVisitor
Than Ngo 505fc8
     void visit(DocSymbol *s)
Than Ngo 505fc8
     {
Than Ngo 505fc8
       indent_leaf();
Than Ngo 505fc8
-      const char *res = HtmlEntityMapper::instance()->utf8(s->symbol());
Than Ngo 505fc8
+      const char *res = HtmlEntityMapper::instance()->utf8(s->symbol(),TRUE);
Than Ngo 505fc8
       if (res)
Than Ngo 505fc8
       {
Than Ngo 505fc8
-        if (qstrcmp(res,"%")==0)
Than Ngo 505fc8
-        {
Than Ngo 505fc8
-          printf("%%");
Than Ngo 505fc8
-        }
Than Ngo 505fc8
-        else
Than Ngo 505fc8
-        {
Than Ngo 505fc8
-          printf("%s",res);
Than Ngo 505fc8
-        }
Than Ngo 505fc8
+        printf("%s",res);
Than Ngo 505fc8
       }
Than Ngo 505fc8
       else
Than Ngo 505fc8
       {
Than Ngo 505fc8
-        printf("print: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
Than Ngo 505fc8
+        printf("print: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
Than Ngo 505fc8
       }
Than Ngo 505fc8
     }
Than Ngo 505fc8
     void visit(DocURL *u)
Than Ngo 505fc8
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
Than Ngo 505fc8
index 2b60d5b..05c8247 100644
Than Ngo 505fc8
--- a/src/rtfdocvisitor.cpp
Than Ngo 505fc8
+++ b/src/rtfdocvisitor.cpp
Than Ngo 505fc8
@@ -129,7 +129,7 @@ void RTFDocVisitor::visit(DocSymbol *s)
Than Ngo 505fc8
   }
Than Ngo 505fc8
   else
Than Ngo 505fc8
   {
Than Ngo 505fc8
-    err("RTF: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
Than Ngo 505fc8
+    err("RTF: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
Than Ngo 505fc8
   }
Than Ngo 505fc8
   m_lastIsPara=FALSE;
Than Ngo 505fc8
 }
Than Ngo 505fc8
diff --git a/src/textdocvisitor.cpp b/src/textdocvisitor.cpp
Than Ngo 505fc8
index a313b0a..6f3151f 100644
Than Ngo 505fc8
--- a/src/textdocvisitor.cpp
Than Ngo 505fc8
+++ b/src/textdocvisitor.cpp
Than Ngo 505fc8
@@ -33,7 +33,7 @@ void TextDocVisitor::visit(DocSymbol *s)
Than Ngo 505fc8
   }
Than Ngo 505fc8
   else
Than Ngo 505fc8
   {
Than Ngo 505fc8
-    err("text: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
Than Ngo 505fc8
+    err("text: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
Than Ngo 505fc8
   }
Than Ngo 505fc8
 }
Than Ngo 505fc8
 
Than Ngo 505fc8
diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp
Than Ngo 505fc8
index 27c8bb9..b906fc1 100644
Than Ngo 505fc8
--- a/src/xmldocvisitor.cpp
Than Ngo 505fc8
+++ b/src/xmldocvisitor.cpp
Than Ngo 505fc8
@@ -78,7 +78,7 @@ void XmlDocVisitor::visit(DocSymbol *s)
Than Ngo 505fc8
   }
Than Ngo 505fc8
   else
Than Ngo 505fc8
   {
Than Ngo 505fc8
-    err("XML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
Than Ngo 505fc8
+    err("XML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
Than Ngo 505fc8
   }
Than Ngo 505fc8
 }
Than Ngo 505fc8