summaryrefslogtreecommitdiffstats
path: root/src/latexdocvisitor.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2002-09-15 19:55:15 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2002-09-15 19:55:15 (GMT)
commit1c72ffcbe310e13d7dda73fa78d6ea4f93636c3e (patch)
tree80bc5b8e1fe89bbf6bd2fbbf2c640eb73313f626 /src/latexdocvisitor.cpp
parent228f1d8a76b93c592888a9c454ecf93983f1e4e3 (diff)
downloadDoxygen-1c72ffcbe310e13d7dda73fa78d6ea4f93636c3e.zip
Doxygen-1c72ffcbe310e13d7dda73fa78d6ea4f93636c3e.tar.gz
Doxygen-1c72ffcbe310e13d7dda73fa78d6ea4f93636c3e.tar.bz2
Release-1.2.17-20020915
Diffstat (limited to 'src/latexdocvisitor.cpp')
-rw-r--r--src/latexdocvisitor.cpp99
1 files changed, 68 insertions, 31 deletions
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index c6a13ab..bc1b17c 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -24,6 +24,48 @@
#include "code.h"
#include "dot.h"
#include "util.h"
+#include "message.h"
+
+static QCString escapeLabelName(const char *s)
+{
+ QCString result;
+ const char *p=s;
+ char c;
+ while ((c=*p++))
+ {
+ switch (c)
+ {
+ case '%': result+="\\%"; break;
+ case '|': result+="\\texttt{\"|}"; break;
+ case '!': result+="\"!"; break;
+ default: result+=c;
+ }
+ }
+ return result;
+}
+
+QCString LatexDocVisitor::escapeMakeIndexChars(const char *s)
+{
+ QCString result;
+ const char *p=s;
+ char str[2]; str[1]=0;
+ char c;
+ while ((c=*p++))
+ {
+ switch (c)
+ {
+ case '!': m_t << "\"!"; break;
+ case '"': m_t << "\"\""; break;
+ case '@': m_t << "\"@"; break;
+ case '|': m_t << "\\texttt{\"|}"; break;
+ case '[': m_t << "["; break;
+ case ']': m_t << "]"; break;
+ default: str[0]=c; filter(str); break;
+ }
+ }
+ return result;
+}
+
LatexDocVisitor::LatexDocVisitor(QTextStream &t,BaseCodeDocInterface &ci)
: m_t(t), m_ci(ci), m_insidePre(FALSE), m_hide(FALSE)
@@ -107,7 +149,7 @@ void LatexDocVisitor::visit(DocSymbol *s)
case DocSymbol::Ring: m_t << "\\" << s->letter() << s->letter(); break;
case DocSymbol::Nbsp: m_t << "\\ "; break;
default:
- printf("Error: unknown symbol found\n");
+ err("Error: unknown symbol found\n");
}
}
@@ -249,6 +291,13 @@ void LatexDocVisitor::visit(DocFormula *f)
m_t << f->text();
}
+void LatexDocVisitor::visit(DocIndexEntry *i)
+{
+ m_t << "\\index{" << escapeLabelName(i->entry()) << "@{";
+ escapeMakeIndexChars(i->entry());
+ m_t << "}}";
+}
+
//--------------------------------------
// visitor functions for compound nodes
//--------------------------------------
@@ -390,26 +439,24 @@ void LatexDocVisitor::visitPre(DocSection *s)
{
m_t << "\\hypertarget{" << s->file() << "_" << s->anchor() << "}{}";
}
- if (s->level()==1)
+ if (Config_getBool("COMPACT_LATEX"))
{
- if (Config_getBool("COMPACT_LATEX"))
- {
- m_t << "\\subsubsection{";
- }
- else
+ switch(s->level())
{
- m_t << "\\subsection{";
+ case 1: m_t << "\\subsubsection{"; break;
+ case 2: m_t << "\\paragraph{"; break;
+ case 3: m_t << "\\subparagraph{"; break;
+ case 4: m_t << "\\subparagraph{"; break;
}
}
- else if (s->level()==2)
+ else
{
- if (Config_getBool("COMPACT_LATEX"))
- {
- m_t << "\\paragraph{";
- }
- else
+ switch(s->level())
{
- m_t << "\\subsubsection{";
+ case 1: m_t << "\\subsection{"; break;
+ case 2: m_t << "\\subsubsection{"; break;
+ case 3: m_t << "\\paragraph{"; break;
+ case 4: m_t << "\\subparagraph{"; break;
}
}
filter(s->title());
@@ -534,16 +581,6 @@ void LatexDocVisitor::visitPost(DocHtmlCell *c)
if (!c->isLast()) m_t << "&";
}
-void LatexDocVisitor::visitPre(DocIndexEntry *)
-{
- m_hide = TRUE;
-}
-
-void LatexDocVisitor::visitPost(DocIndexEntry *)
-{
- m_hide = FALSE;
-}
-
void LatexDocVisitor::visitPre(DocInternal *)
{
m_t << "\\begin{Desc}" << endl
@@ -577,18 +614,18 @@ void LatexDocVisitor::visitPre(DocHtmlHeader *header)
{
switch(header->level())
{
- case 1: m_t << "\\subsection{"; break;
- case 2: m_t << "\\subsubsection{"; break;
- case 3: m_t << "\\paragraph{"; break;
+ case 1: m_t << "\\subsection*{"; break;
+ case 2: m_t << "\\subsubsection*{"; break;
+ case 3: m_t << "\\paragraph*{"; break;
}
}
else
{
switch(header->level())
{
- case 1: m_t << "\\section{"; break;
- case 2: m_t << "\\subsection{"; break;
- case 3: m_t << "\\subsubsection{"; break;
+ case 1: m_t << "\\section*{"; break;
+ case 2: m_t << "\\subsection*{"; break;
+ case 3: m_t << "\\subsubsection*{"; break;
}
}
}