Commit dd2c1378 authored by albert-github's avatar albert-github
Browse files

Enabling possibility to have { and } in (latex) index items

In the doxygen manual the index items for \{ and \} were missing due to the missing support for the usage of { and } in parts of the code.
This patch fixes this problem by introducing 2 new latex commands. See also http://tex.stackexchange.com/questions/153291/index-unmatched-braces-in-latex
Further improvements in the index are:
- consistency in different places
- correction of index for \::
- placing \~ on a more logical place (together with other special characters, ~ is in the ASCII table after a-z whilst other characters are before this range)
parent de9e2e0b
Loading
Loading
Loading
Loading
+6 −2
Original line number Original line Diff line number Diff line
@@ -2696,6 +2696,8 @@ class Receiver
<hr>
<hr>
\section cmdfcurlyopen \\f{environment}{
\section cmdfcurlyopen \\f{environment}{


  \addindex \\f{

  Marks the start of a formula that is in a specific environment.
  Marks the start of a formula that is in a specific environment.
  \note The second \c { is optional and is only to help editors (such as \c Vim) to
  \note The second \c { is optional and is only to help editors (such as \c Vim) to
  do proper syntax highlighting by making the number of opening and closing braces
  do proper syntax highlighting by making the number of opening and closing braces
@@ -2705,6 +2707,8 @@ class Receiver
<hr>
<hr>
\section cmdfcurlyclose \\f}
\section cmdfcurlyclose \\f}


  \addindex \\f}

  Marks the end of a formula that is in a specific environment.
  Marks the end of a formula that is in a specific environment.
  \sa section \ref cmdfcurlyopen "\\f{" and section \ref formulas "formulas".
  \sa section \ref cmdfcurlyopen "\\f{" and section \ref formulas "formulas".


@@ -3030,7 +3034,7 @@ class Receiver
\section cmdchardot \\.
\section cmdchardot \\.


  \addindex \\\.
  \addindex \\\.
  This command writes a dot (\c .) to the output. This can be useful to 
  This command writes a dot (`.`) to the output. This can be useful to 
  prevent ending a brief description when JAVADOC_AUTOBRIEF is enabled
  prevent ending a brief description when JAVADOC_AUTOBRIEF is enabled
  or to prevent starting a numbered list when the dot follows a number at
  or to prevent starting a numbered list when the dot follows a number at
  the start of a line.
  the start of a line.
@@ -3038,7 +3042,7 @@ class Receiver
<hr>
<hr>
\section cmddcolon \\::
\section cmddcolon \\::


  \addindex \\\::
  \addindex \\::
  This command writes a double colon (\c \::) to the output. This
  This command writes a double colon (\c \::) to the output. This
  character sequence has to be escaped in some cases, because it is used
  character sequence has to be escaped in some cases, because it is used
  to reference to documented entities.
  to reference to documented entities.
+2 −0
Original line number Original line Diff line number Diff line
@@ -381,6 +381,8 @@
}
}


\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})}
\newcommand{\doxyref}[3]{\textbf{#1} (\textnormal{#2}\,\pageref{#3})}
\newcommand{\lcurly}{\{}
\newcommand{\rcurly}{\}}
\newenvironment{DoxyCompactList}
\newenvironment{DoxyCompactList}
{\begin{list}{}{
{\begin{list}{}{
  \setlength{\leftmargin}{0.5cm}
  \setlength{\leftmargin}{0.5cm}
+4 −0
Original line number Original line Diff line number Diff line
@@ -450,6 +450,10 @@
  \textbf{#1} (\textnormal{#2}\,\pageref{#3})%
  \textbf{#1} (\textnormal{#2}\,\pageref{#3})%
}
}


% Used by @addindex
\newcommand{\lcurly}{\{}
\newcommand{\rcurly}{\}}

% Used for syntax highlighting
% Used for syntax highlighting
\definecolor{comment}{rgb}{0.5,0.0,0.0}
\definecolor{comment}{rgb}{0.5,0.0,0.0}
\definecolor{keyword}{rgb}{0.0,0.5,0.0}
\definecolor{keyword}{rgb}{0.0,0.5,0.0}
+5 −0
Original line number Original line Diff line number Diff line
@@ -44,6 +44,9 @@ static QCString escapeLabelName(const char *s)
      case '%': result+="\\%"; break;
      case '%': result+="\\%"; break;
      case '|': result+="\\texttt{\"|}"; break;
      case '|': result+="\\texttt{\"|}"; break;
      case '!': result+="\"!"; break;
      case '!': result+="\"!"; break;
      case '{': result+="\\lcurly{}"; break;
      case '}': result+="\\rcurly{}"; break;
      case '~': result+="````~"; break; // to get it a bit better in index together with other special characters
      default: result+=c;
      default: result+=c;
    }
    }
  }
  }
@@ -79,6 +82,8 @@ QCString LatexDocVisitor::escapeMakeIndexChars(const char *s)
      case '|': m_t << "\\texttt{\"|}"; break;
      case '|': m_t << "\\texttt{\"|}"; break;
      case '[': m_t << "["; break;
      case '[': m_t << "["; break;
      case ']': m_t << "]"; break;
      case ']': m_t << "]"; break;
      case '{': m_t << "\\lcurly{}"; break;
      case '}': m_t << "\\rcurly{}"; break;
      default:  str[0]=c; filter(str); break;
      default:  str[0]=c; filter(str); break;
    }
    }
  }
  }
+15 −4
Original line number Original line Diff line number Diff line
@@ -1374,8 +1374,10 @@ void LatexGenerator::startMemberDoc(const char *clname,
    t << "}";
    t << "}";
    if (clname)
    if (clname)
    {
    {
      t << "!" << clname << "@{";
      t << "!";
      docify(clname);
      escapeLabelName(clname);
      t << "@{";
      escapeMakeIndexChars(clname);
      t << "}"; 
      t << "}"; 
    }
    }
    t << "}" << endl;
    t << "}" << endl;
@@ -2012,13 +2014,18 @@ void LatexGenerator::escapeLabelName(const char *s)
  {
  {
    switch (c)
    switch (c)
    {
    {
      case '|': t << "\\texttt{\"|}"; break;
      case '!': t << "\"!"; break;
      case '%': t << "\\%";       break;
      case '%': t << "\\%";       break;
      case '{': t << "\\lcurly{}"; break;
      case '}': t << "\\rcurly{}"; break;
      case '~': t << "````~"; break; // to get it a bit better in index together with other special characters
      // NOTE: adding a case here, means adding it to while below as well!
      // NOTE: adding a case here, means adding it to while below as well!
      default:  
      default:  
        i=0;
        i=0;
        // collect as long string as possible, before handing it to docify
        // collect as long string as possible, before handing it to docify
        result[i++]=c;
        result[i++]=c;
        while ((c=*p) && c!='%')
        while ((c=*p) && c!='|' && c!='!' && c!='%' && c!='{' && c!='}' && c!='~')
        {
        {
          result[i++]=c;
          result[i++]=c;
          p++;
          p++;
@@ -2041,16 +2048,20 @@ void LatexGenerator::escapeMakeIndexChars(const char *s)
  {
  {
    switch (c)
    switch (c)
    {
    {
      case '!': t << "\"!"; break;
      case '"': t << "\"\""; break;
      case '"': t << "\"\""; break;
      case '@': t << "\"@"; break;
      case '@': t << "\"@"; break;
      case '|': t << "\\texttt{\"|}"; break;
      case '[': t << "["; break;
      case '[': t << "["; break;
      case ']': t << "]"; break;
      case ']': t << "]"; break;
      case '{': t << "\\lcurly{}"; break;
      case '}': t << "\\rcurly{}"; break;
      // NOTE: adding a case here, means adding it to while below as well!
      // NOTE: adding a case here, means adding it to while below as well!
      default:  
      default:  
        i=0;
        i=0;
        // collect as long string as possible, before handing it to docify
        // collect as long string as possible, before handing it to docify
        result[i++]=c;
        result[i++]=c;
        while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']')
        while ((c=*p) && c!='"' && c!='@' && c!='[' && c!=']' && c!='!' && c!='{' && c!='}' && c!='|')
        {
        {
          result[i++]=c;
          result[i++]=c;
          p++;
          p++;