diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2011-04-26 10:48:48 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2011-04-26 10:48:48 (GMT) |
commit | c604d141eb8b0708022a3e4b48b0b1871b692aa6 (patch) | |
tree | 5b1b526ababed94fc83b11349dd828da3bf11882 /src/latexdocvisitor.cpp | |
parent | 145b564516f82be1bb4cc5a82277e7c9d10ca5ca (diff) | |
download | Doxygen-c604d141eb8b0708022a3e4b48b0b1871b692aa6.zip Doxygen-c604d141eb8b0708022a3e4b48b0b1871b692aa6.tar.gz Doxygen-c604d141eb8b0708022a3e4b48b0b1871b692aa6.tar.bz2 |
Release-1.7.4-20110426
Diffstat (limited to 'src/latexdocvisitor.cpp')
-rw-r--r-- | src/latexdocvisitor.cpp | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp index 48e3675..6d53f37 100644 --- a/src/latexdocvisitor.cpp +++ b/src/latexdocvisitor.cpp @@ -46,6 +46,28 @@ static QCString escapeLabelName(const char *s) return result; } +static bool isSymbol(const char *s) +{ + int l=0; // word length + int nCaps=0; // number of captials + int nCamels=0; // number of lowerCase+upperCase combos + int nUnscore=0; // number of underscores + const char *p=s; + char c; + bool plo=FALSE; + while ((c=*p++)) + { + bool lo=c>='a' && c<='z'; + bool up=c>='A' && c<='Z'; + if (c=='_') nUnscore++; + if (up) nCaps++; + if (up && plo) nCamels++; + plo=lo; + l++; + } + return l>=20 || nCaps>=4 || nCamels>=2 || nUnscore>0; +} + const int maxLevels=5; static const char *secLabels[maxLevels] = { "section","subsection","subsubsection","paragraph","subparagraph" }; @@ -100,7 +122,8 @@ LatexDocVisitor::LatexDocVisitor(FTextStream &t,CodeOutputInterface &ci, const char *langExt,bool insideTabbing) : DocVisitor(DocVisitor_Latex), m_t(t), m_ci(ci), m_insidePre(FALSE), m_insideItem(FALSE), m_hide(FALSE), m_insideTabbing(insideTabbing), - m_langExt(langExt), m_currentColumn(0), m_inRowspan(FALSE) + m_forceBreaks(FALSE), m_langExt(langExt), m_currentColumn(0), + m_inRowspan(FALSE) { } @@ -111,14 +134,14 @@ LatexDocVisitor::LatexDocVisitor(FTextStream &t,CodeOutputInterface &ci, void LatexDocVisitor::visit(DocWord *w) { if (m_hide) return; - filter(w->word()); + filter(w->word(),isSymbol(w->word())); } void LatexDocVisitor::visit(DocLinkedWord *w) { if (m_hide) return; startLink(w->ref(),w->file(),w->anchor()); - filter(w->word()); + filter(w->word(),isSymbol(w->word())); endLink(w->ref(),w->file(),w->anchor()); } @@ -1301,17 +1324,18 @@ void LatexDocVisitor::visitPost(DocCopy *) { } -void LatexDocVisitor::visitPre(DocText *) +void LatexDocVisitor::visitPre(DocText *t) { + m_forceBreaks = t->forceBreaks(); } void LatexDocVisitor::visitPost(DocText *) { } -void LatexDocVisitor::filter(const char *str) +void LatexDocVisitor::filter(const char *str,bool forceBreaks) { - filterLatexString(m_t,str,m_insideTabbing,m_insidePre,m_insideItem); + filterLatexString(m_t,str,m_insideTabbing,m_insidePre,m_insideItem,m_forceBreaks || forceBreaks); } void LatexDocVisitor::startLink(const QCString &ref,const QCString &file,const QCString &anchor) |