Skip to content

Commit

Permalink
Bug 783134 - LaTeX output for \tparam block fails to compile when it …
Browse files Browse the repository at this point in the history
…contains a \code block

General problem regarding having a code / verbatim section inside a table.
Besides handling of the $ some other characters need special handling as well as the \n.
  • Loading branch information
albert-github committed May 28, 2017
1 parent 9b7b339 commit d59ed22
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/latexdocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "plantuml.h"

const int maxLevels=5;
int usedTableLevels = 0;
static const char *secLabels[maxLevels] =
{ "section","subsection","subsubsection","paragraph","subparagraph" };

Expand Down Expand Up @@ -1391,6 +1392,7 @@ void LatexDocVisitor::visitPre(DocParamSect *s)
if (m_hide) return;
bool hasInOutSpecs = s->hasInOutSpecifier();
bool hasTypeSpecs = s->hasTypeSpecifier();
usedTableLevels++;
switch(s->type())
{
case DocParamSect::Param:
Expand Down Expand Up @@ -1424,6 +1426,7 @@ void LatexDocVisitor::visitPre(DocParamSect *s)
void LatexDocVisitor::visitPost(DocParamSect *s)
{
if (m_hide) return;
usedTableLevels--;
switch(s->type())
{
case DocParamSect::Param:
Expand Down
1 change: 1 addition & 0 deletions src/latexdocvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <qcstring.h>
#include <qlist.h>
//#include <qmap.h>
extern int usedTableLevels;

class FTextStream;
class CodeOutputInterface;
Expand Down
6 changes: 5 additions & 1 deletion src/latexgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ void LatexCodeGenerator::codify(const char *str)
m_col+=spacesToNextTabStop;
p++;
break;
case '\n': m_t << '\n'; m_col=0; p++;
case '\n': (usedTableLevels>0) ? m_t << "\\newline\n" : m_t << '\n'; m_col=0; p++;
break;
default:
i=0;
Expand Down Expand Up @@ -1843,11 +1843,13 @@ void LatexGenerator::writeNonBreakableSpace(int)

void LatexGenerator::startDescTable(const char *title)
{
usedTableLevels++;
t << "\\begin{DoxyEnumFields}{" << title << "}" << endl;
}

void LatexGenerator::endDescTable()
{
usedTableLevels--;
t << "\\end{DoxyEnumFields}" << endl;
}

Expand Down Expand Up @@ -2190,6 +2192,7 @@ void LatexGenerator::lineBreak(const char *)

void LatexGenerator::startMemberDocSimple(bool isEnum)
{
usedTableLevels++;
if (isEnum)
{
t << "\\begin{DoxyEnumFields}{";
Expand All @@ -2205,6 +2208,7 @@ void LatexGenerator::startMemberDocSimple(bool isEnum)

void LatexGenerator::endMemberDocSimple(bool isEnum)
{
usedTableLevels--;
if (isEnum)
{
t << "\\end{DoxyEnumFields}" << endl;
Expand Down
7 changes: 7 additions & 0 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include "searchindex.h"
#include "doxygen.h"
#include "textdocvisitor.h"
#include "latexdocvisitor.h"
#include "portable.h"
#include "parserintf.h"
#include "bufstr.h"
Expand Down Expand Up @@ -6655,6 +6656,12 @@ void filterLatexString(FTextStream &t,const char *str,
case '{': t << "\\{"; break;
case '}': t << "\\}"; break;
case '_': t << "\\_"; break;
case '&': t << "\\&"; break;
case '%': t << "\\%"; break;
case '#': t << "\\#"; break;
case '$': t << "\\$"; break;
case '^': (usedTableLevels>0) ? t << "\\string^" : t << (char)c; break;
case '~': (usedTableLevels>0) ? t << "\\string~" : t << (char)c; break;
case ' ': if (keepSpaces) t << "~"; else t << ' ';
break;
default:
Expand Down

0 comments on commit d59ed22

Please sign in to comment.