summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2015-06-29 17:45:55 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2015-07-12 11:00:45 (GMT)
commit647b6ac8669cd8ba1e8c60eeb3c2de961c7d6a1b (patch)
tree47030a5aefd5c239cf466dbee23cc877e5b54ea1 /src
parent942efcb758977fe95fafc473813528085b56e4ee (diff)
downloadDoxygen-647b6ac8669cd8ba1e8c60eeb3c2de961c7d6a1b.zip
Doxygen-647b6ac8669cd8ba1e8c60eeb3c2de961c7d6a1b.tar.gz
Doxygen-647b6ac8669cd8ba1e8c60eeb3c2de961c7d6a1b.tar.bz2
Using tabu package for LaTeX tables
Diffstat (limited to 'src')
-rw-r--r--src/docparser.h19
-rw-r--r--src/latexdocvisitor.cpp30
-rw-r--r--src/latexdocvisitor.h1
-rw-r--r--src/latexgen.cpp8
-rw-r--r--src/util.cpp3
5 files changed, 50 insertions, 11 deletions
diff --git a/src/docparser.h b/src/docparser.h
index 1abb687..4984921 100644
--- a/src/docparser.h
+++ b/src/docparser.h
@@ -1303,8 +1303,18 @@ class DocHtmlRow : public CompAccept<DocHtmlRow>, public DocNode
const HtmlAttribList &attribs() const { return m_attribs; }
int parse();
int parseXml(bool header);
- bool isHeading() const { return m_children.count()>0 &&
- ((DocHtmlCell*)m_children.getFirst())->isHeading();
+ bool isHeading() const { // a row is a table heading if all cells are marked as such
+ bool heading=TRUE;
+ QListIterator<DocNode> it(m_children);
+ DocNode *n;
+ for (;(n=it.current());++it)
+ {
+ if (n->kind()==Kind_HtmlCell)
+ {
+ heading = heading && ((DocHtmlCell*)n)->isHeading();
+ }
+ }
+ return m_children.count()>0 && heading;
}
void setVisibleCells(int n) { m_visibleCells = n; }
int visibleCells() const { return m_visibleCells; }
@@ -1332,6 +1342,11 @@ class DocHtmlTable : public CompAccept<DocHtmlTable>, public DocNode
int parseXml();
uint numColumns() const { return m_numCols; }
void accept(DocVisitor *v);
+ DocHtmlRow *firstRow() {
+ DocNode *n = m_children.getFirst();
+ if (n && n->kind()==Kind_HtmlRow) return (DocHtmlRow*)n;
+ return 0;
+ }
private:
void computeTableGrid();
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index 37c2130..b9e5839 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -173,7 +173,7 @@ LatexDocVisitor::LatexDocVisitor(FTextStream &t,CodeOutputInterface &ci,
: DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE),
m_insideItem(FALSE), m_hide(FALSE), m_insideTabbing(insideTabbing),
m_insideTable(FALSE), m_langExt(langExt), m_currentColumn(0),
- m_inRowspan(FALSE), m_inColspan(FALSE)
+ m_inRowspan(FALSE), m_inColspan(FALSE), m_firstRow(FALSE)
{
m_rowSpans.setAutoDelete(TRUE);
}
@@ -913,6 +913,17 @@ void LatexDocVisitor::visitPre(DocHtmlTable *t)
m_t << "\\begin{" << getTableName(t->parent()) << "}{" << t->numColumns() << "}\n";
m_numCols = t->numColumns();
m_t << "\\hline\n";
+
+ // check if first row is a heading and then render the row already here
+ // and end it with \endfirsthead (triggered via m_firstRow==TRUE)
+ // then repeat the row as normal and end it with \endhead (m_firstRow==FALSE)
+ DocHtmlRow *firstRow = t->firstRow();
+ if (firstRow && firstRow->isHeading())
+ {
+ m_firstRow=TRUE;
+ firstRow->accept(this);
+ m_firstRow=FALSE;
+ }
}
void LatexDocVisitor::visitPost(DocHtmlTable *t)
@@ -944,7 +955,7 @@ void LatexDocVisitor::visitPost(DocHtmlCaption *)
void LatexDocVisitor::visitPre(DocHtmlRow *r)
{
m_currentColumn = 0;
- if (r->isHeading()) m_t << "\\rowcolor{lightgray}";
+ if (r->isHeading()) m_t << "\\rowcolor{\\tableheadbgcolor}";
}
void LatexDocVisitor::visitPost(DocHtmlRow *row)
@@ -1011,6 +1022,19 @@ void LatexDocVisitor::visitPost(DocHtmlRow *row)
}
m_t << "\n";
+
+ if (row->isHeading() && row->rowIndex()==1)
+ {
+ if (m_firstRow)
+ {
+ m_t << "\\endfirsthead" << endl;
+ m_t << "\\hline" << endl;
+ }
+ else
+ {
+ m_t << "\\endhead" << endl;
+ }
+ }
}
void LatexDocVisitor::visitPre(DocHtmlCell *c)
@@ -1076,7 +1100,7 @@ void LatexDocVisitor::visitPre(DocHtmlCell *c)
<< m_numCols << "-\\arrayrulewidth*"
<< row->visibleCells() << ")*"
<< cs <<"/"<< m_numCols << "}|}{";
- if (c->isHeading()) m_t << "\\cellcolor{lightgray}";
+ if (c->isHeading()) m_t << "\\cellcolor{\\tableheadbgcolor}";
}
int rs = c->rowSpan();
if (rs>0)
diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h
index d3aeaea..e36e56c 100644
--- a/src/latexdocvisitor.h
+++ b/src/latexdocvisitor.h
@@ -199,6 +199,7 @@ class LatexDocVisitor : public DocVisitor
int m_currentColumn;
bool m_inRowspan;
bool m_inColspan;
+ bool m_firstRow;
};
#endif
diff --git a/src/latexgen.cpp b/src/latexgen.cpp
index 042dd7c..30e28ec 100644
--- a/src/latexgen.cpp
+++ b/src/latexgen.cpp
@@ -1422,6 +1422,10 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *,
const char *anchor, const char *,
const char *)
{
+}
+
+void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor)
+{
static bool pdfHyperlinks = Config_getBool("PDF_HYPERLINKS");
static bool usePDFLatex = Config_getBool("USE_PDFLATEX");
if (usePDFLatex && pdfHyperlinks)
@@ -1431,10 +1435,6 @@ void LatexGenerator::startDoxyAnchor(const char *fName,const char *,
if (anchor) t << "_" << anchor;
t << "}{}";
}
-}
-
-void LatexGenerator::endDoxyAnchor(const char *fName,const char *anchor)
-{
t << "\\label{";
if (fName) t << stripPath(fName);
if (anchor) t << "_" << anchor;
diff --git a/src/util.cpp b/src/util.cpp
index 3ee7ae5..d367c40 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -6461,7 +6461,6 @@ void filterLatexString(FTextStream &t,const char *str,
bool insideTabbing,bool insidePre,bool insideItem)
{
if (str==0) return;
- //printf("filterLatexString(%s)\n",str);
//if (strlen(str)<2) stackTrace();
const unsigned char *p=(const unsigned char *)str;
const unsigned char *q;
@@ -6555,7 +6554,7 @@ void filterLatexString(FTextStream &t,const char *str,
default:
//if (!insideTabbing && forceBreaks && c!=' ' && *p!=' ')
if (!insideTabbing &&
- ((c>='A' && c<='Z' && pc!=' ' && pc!='\0') || (c==':' && pc!=':') || (pc=='.' && isId(c)))
+ ((c>='A' && c<='Z' && pc!=' ' && pc!='\0' && *p) || (c==':' && pc!=':') || (pc=='.' && isId(c)))
)
{
t << "\\+";