Commit 0e080f48 authored by Dimitri van Heesch's avatar Dimitri van Heesch
Browse files

Improved handling of percent symbol

parent a28ff233
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ void DocbookDocVisitor::visit(DocSymbol *s)
  }
  }
  else
  else
  {
  {
    err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
    err("DocBook: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
  }
  }
}
}


+1 −1
Original line number Original line Diff line number Diff line
@@ -190,7 +190,7 @@ void HtmlDocVisitor::visit(DocSymbol *s)
  }
  }
  else
  else
  {
  {
    err("HTML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
    err("HTML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
  }
  }
}
}


+24 −6
Original line number Original line Diff line number Diff line
@@ -354,24 +354,42 @@ void HtmlEntityMapper::deleteInstance()
/*! @brief Access routine to the UTF8 code of the HTML entity
/*! @brief Access routine to the UTF8 code of the HTML entity
 *
 *
 * @param symb Code of the requested 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,
 * @return the UTF8 code of the HTML entity,
 *         in case the UTF code is unknown \c NULL is returned.
 *         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
{
  if (useInPrintf && symb==DocSymbol::Sym_Percent)
  {
    return "%%"; // escape for printf
  }
  else
  {
  {
    return g_htmlEntities[symb].UTF8;
    return g_htmlEntities[symb].UTF8;
  }
  }
}


/*! @brief Access routine to the html code of the HTML entity
/*! @brief Access routine to the html code of the HTML entity
 *
 *
 * @param symb        Code of the requested HTML entity
 * @param symb        Code of the requested HTML entity
 * @return the html of the 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.
 *         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
{
  if (useInPrintf && symb==DocSymbol::Sym_Percent)
  {
    return "%%"; // escape for printf
  }
  else
  {
  {
    return g_htmlEntities[symb].html;
    return g_htmlEntities[symb].html;
  }
  }
}


/*! @brief Access routine to the XML code of the HTML entity
/*! @brief Access routine to the XML code of the HTML entity
 *
 *
+2 −2
Original line number Original line Diff line number Diff line
@@ -27,8 +27,8 @@ class HtmlEntityMapper
    static HtmlEntityMapper *instance();
    static HtmlEntityMapper *instance();
    static void deleteInstance();
    static void deleteInstance();
    DocSymbol::SymType name2sym(const QCString &symName) const;
    DocSymbol::SymType name2sym(const QCString &symName) const;
    const char *utf8(DocSymbol::SymType symb) const;
    const char *utf8(DocSymbol::SymType symb,bool useInPrintf=FALSE) const;
    const char *html(DocSymbol::SymType symb) const;
    const char *html(DocSymbol::SymType symb,bool useInPrintf=FALSE) const;
    const char *xml(DocSymbol::SymType symb) const;
    const char *xml(DocSymbol::SymType symb) const;
    const char *docbook(DocSymbol::SymType symb) const;
    const char *docbook(DocSymbol::SymType symb) const;
    const char *latex(DocSymbol::SymType symb) const;
    const char *latex(DocSymbol::SymType symb) const;
+1 −1
Original line number Original line Diff line number Diff line
@@ -154,7 +154,7 @@ void LatexDocVisitor::visit(DocSymbol *s)
  }
  }
  else
  else
  {
  {
    err("LaTeX: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol()));
    err("LaTeX: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE));
  }
  }
}
}


Loading