diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:51:13 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-10-15 10:51:13 +0900 |
commit | b65cb2d67b946445ba89e1938cee8527969922cd (patch) | |
tree | e3aff002a9b580aef8a80eb3823786993c3a5c64 /src/htmldocvisitor.cpp | |
parent | 738086af77ab085837d0044a33a5d954a3edc6f5 (diff) | |
download | doxygen-b65cb2d67b946445ba89e1938cee8527969922cd.tar.gz doxygen-b65cb2d67b946445ba89e1938cee8527969922cd.tar.bz2 doxygen-b65cb2d67b946445ba89e1938cee8527969922cd.zip |
Imported Upstream version 1.8.7upstream/1.8.7
Diffstat (limited to 'src/htmldocvisitor.cpp')
-rw-r--r-- | src/htmldocvisitor.cpp | 178 |
1 files changed, 47 insertions, 131 deletions
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 6ccbda4..c70f2c5 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -3,7 +3,7 @@ * * * - * Copyright (C) 1997-2013 by Dimitri van Heesch. + * Copyright (C) 1997-2014 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its * documentation under the terms of the GNU General Public License is hereby @@ -33,6 +33,7 @@ #include "vhdldocgen.h" #include "filedef.h" #include "memberdef.h" +#include "htmlentity.h" static const int NUM_HTML_LIST_TYPES = 4; static const char types[][NUM_HTML_LIST_TYPES] = {"1", "a", "i", "A"}; @@ -43,27 +44,30 @@ static QCString convertIndexWordToAnchor(const QString &word) QCString result; const char *str = word.data(); unsigned char c; - while ((c = *str++)) - { - if ((c >= 'a' && c <= 'z') || // ALPHA - (c >= 'A' && c <= 'A') || // ALPHA - (c >= '0' && c <= '9') || // DIGIT - c == '-' || - c == '.' || - c == '_' || - c == '~' - ) - { - result += c; - } - else + if (str) + { + while ((c = *str++)) { - char enc[4]; - enc[0] = '%'; - enc[1] = hex[(c & 0xf0) >> 4]; - enc[2] = hex[c & 0xf]; - enc[3] = 0; - result += enc; + if ((c >= 'a' && c <= 'z') || // ALPHA + (c >= 'A' && c <= 'A') || // ALPHA + (c >= '0' && c <= '9') || // DIGIT + c == '-' || + c == '.' || + c == '_' || + c == '~' + ) + { + result += c; + } + else + { + char enc[4]; + enc[0] = '%'; + enc[1] = hex[(c & 0xf0) >> 4]; + enc[2] = hex[c & 0xf]; + enc[3] = 0; + result += enc; + } } } return result; @@ -91,7 +95,6 @@ static bool mustBeOutsideParagraph(DocNode *n) case DocNode::Kind_Internal: /* <div> */ case DocNode::Kind_Include: - case DocNode::Kind_Verbatim: case DocNode::Kind_Image: case DocNode::Kind_SecRefList: /* <hr> */ @@ -106,6 +109,11 @@ static bool mustBeOutsideParagraph(DocNode *n) /* \parblock */ case DocNode::Kind_ParBlock: return TRUE; + case DocNode::Kind_Verbatim: + { + DocVerbatim *dv = (DocVerbatim*)n; + return dv->type()!=DocVerbatim::HtmlOnly || dv->isBlock(); + } case DocNode::Kind_StyleChange: return ((DocStyleChange*)n)->style()==DocStyleChange::Preformatted || ((DocStyleChange*)n)->style()==DocStyleChange::Div || @@ -182,110 +190,14 @@ void HtmlDocVisitor::visit(DocWhiteSpace *w) void HtmlDocVisitor::visit(DocSymbol *s) { if (m_hide) return; - switch(s->symbol()) - { - case DocSymbol::BSlash: m_t << "\\"; break; - case DocSymbol::At: m_t << "@"; break; - case DocSymbol::Less: m_t << "<"; break; - case DocSymbol::Greater: m_t << ">"; break; - case DocSymbol::Amp: m_t << "&"; break; - case DocSymbol::Dollar: m_t << "$"; break; - case DocSymbol::Hash: m_t << "#"; break; - case DocSymbol::DoubleColon: m_t << "::"; break; - case DocSymbol::Percent: m_t << "%"; break; - case DocSymbol::Pipe: m_t << "|"; break; - case DocSymbol::Copy: m_t << "©"; break; - case DocSymbol::Tm: m_t << "™"; break; - case DocSymbol::Reg: m_t << "®"; break; - case DocSymbol::Apos: m_t << "'"; break; - case DocSymbol::Quot: m_t << "\""; break; - case DocSymbol::Lsquo: m_t << "‘"; break; - case DocSymbol::Rsquo: m_t << "’"; break; - case DocSymbol::Ldquo: m_t << "“"; break; - case DocSymbol::Rdquo: m_t << "”"; break; - case DocSymbol::Ndash: m_t << "–"; break; - case DocSymbol::Mdash: m_t << "—"; break; - case DocSymbol::Uml: m_t << "&" << s->letter() << "uml;"; break; - case DocSymbol::Acute: m_t << "&" << s->letter() << "acute;"; break; - case DocSymbol::Grave: m_t << "&" << s->letter() << "grave;"; break; - case DocSymbol::Circ: m_t << "&" << s->letter() << "circ;"; break; - case DocSymbol::Slash: m_t << "&" << s->letter() << "slash;"; break; - case DocSymbol::Tilde: m_t << "&" << s->letter() << "tilde;"; break; - case DocSymbol::Szlig: m_t << "ß"; break; - case DocSymbol::Cedil: m_t << "&" << s->letter() << "cedil;"; break; - case DocSymbol::Ring: m_t << "&" << s->letter() << "ring;"; break; - case DocSymbol::Nbsp: m_t << " "; break; - case DocSymbol::AElig: m_t << "Æ"; break; - case DocSymbol::Aelig: m_t << "æ"; break; - case DocSymbol::GrkGamma: m_t << "Γ"; break; - case DocSymbol::GrkDelta: m_t << "Δ"; break; - case DocSymbol::GrkTheta: m_t << "Θ"; break; - case DocSymbol::GrkLambda: m_t << "Λ"; break; - case DocSymbol::GrkXi: m_t << "Ξ"; break; - case DocSymbol::GrkPi: m_t << "Π"; break; - case DocSymbol::GrkSigma: m_t << "Σ"; break; - case DocSymbol::GrkUpsilon: m_t << "Υ"; break; - case DocSymbol::GrkPhi: m_t << "Φ"; break; - case DocSymbol::GrkPsi: m_t << "Ψ"; break; - case DocSymbol::GrkOmega: m_t << "Ω"; break; - case DocSymbol::Grkalpha: m_t << "α"; break; - case DocSymbol::Grkbeta: m_t << "β"; break; - case DocSymbol::Grkgamma: m_t << "γ"; break; - case DocSymbol::Grkdelta: m_t << "δ"; break; - case DocSymbol::Grkepsilon: m_t << "ε"; break; - case DocSymbol::Grkzeta: m_t << "ζ"; break; - case DocSymbol::Grketa: m_t << "η"; break; - case DocSymbol::Grktheta: m_t << "θ"; break; - case DocSymbol::Grkiota: m_t << "ι"; break; - case DocSymbol::Grkkappa: m_t << "κ"; break; - case DocSymbol::Grklambda: m_t << "λ"; break; - case DocSymbol::Grkmu: m_t << "μ"; break; - case DocSymbol::Grknu: m_t << "ν"; break; - case DocSymbol::Grkxi: m_t << "ξ"; break; - case DocSymbol::Grkpi: m_t << "π"; break; - case DocSymbol::Grkrho: m_t << "ρ"; break; - case DocSymbol::Grksigma: m_t << "σ"; break; - case DocSymbol::Grktau: m_t << "τ"; break; - case DocSymbol::Grkupsilon: m_t << "υ"; break; - case DocSymbol::Grkphi: m_t << "φ"; break; - case DocSymbol::Grkchi: m_t << "χ"; break; - case DocSymbol::Grkpsi: m_t << "ψ"; break; - case DocSymbol::Grkomega: m_t << "ω"; break; - case DocSymbol::Grkvarsigma: m_t << "ς"; break; - case DocSymbol::Section: m_t << "§"; break; - case DocSymbol::Degree: m_t << "°"; break; - case DocSymbol::Prime: m_t << "′"; break; - case DocSymbol::DoublePrime: m_t << "″"; break; - case DocSymbol::Infinity: m_t << "∞"; break; - case DocSymbol::EmptySet: m_t << "∅"; break; - case DocSymbol::PlusMinus: m_t << "±"; break; - case DocSymbol::Times: m_t << "×"; break; - case DocSymbol::Minus: m_t << "−"; break; - case DocSymbol::CenterDot: m_t << "⋅"; break; - case DocSymbol::Partial: m_t << "∂"; break; - case DocSymbol::Nabla: m_t << "∇"; break; - case DocSymbol::SquareRoot: m_t << "√"; break; - case DocSymbol::Perpendicular: m_t << "⊥"; break; - case DocSymbol::Sum: m_t << "∑"; break; - case DocSymbol::Integral: m_t << "∫"; break; - case DocSymbol::Product: m_t << "∏"; break; - case DocSymbol::Similar: m_t << "∼"; break; - case DocSymbol::Approx: m_t << "≈"; break; - case DocSymbol::NotEqual: m_t << "≠"; break; - case DocSymbol::Equivalent: m_t << "≡"; break; - case DocSymbol::Proportional: m_t << "∝"; break; - case DocSymbol::LessEqual: m_t << "≤"; break; - case DocSymbol::GreaterEqual: m_t << "≥"; break; - case DocSymbol::LeftArrow: m_t << "←"; break; - case DocSymbol::RightArrow: m_t << "→"; break; - case DocSymbol::SetIn: m_t << "∈"; break; - case DocSymbol::SetNotIn: m_t << "∉"; break; - case DocSymbol::LeftCeil: m_t << "⌈"; break; - case DocSymbol::RightCeil: m_t << "⌉"; break; - case DocSymbol::LeftFloor: m_t << "⌊"; break; - case DocSymbol::RightFloor: m_t << "⌋"; break; - default: - err("unknown symbol found\n"); + const char *res = HtmlEntityMapper::instance()->html(s->symbol()); + if (res) + { + m_t << res; + } + else + { + err("HTML: non supported HTML-entity found: %s\n",HtmlEntityMapper::instance()->html(s->symbol(),TRUE)); } } @@ -332,7 +244,7 @@ void HtmlDocVisitor::visit(DocURL *u) void HtmlDocVisitor::visit(DocLineBreak *) { if (m_hide) return; - m_t << "<br/>\n"; + m_t << "<br />\n"; } void HtmlDocVisitor::visit(DocHorRuler *hr) @@ -452,7 +364,9 @@ void HtmlDocVisitor::visit(DocVerbatim *s) forceStartParagraph(s); break; case DocVerbatim::HtmlOnly: + if (s->isBlock()) forceEndParagraph(s); m_t << s->text(); + if (s->isBlock()) forceStartParagraph(s); break; case DocVerbatim::ManOnly: case DocVerbatim::LatexOnly: @@ -585,6 +499,8 @@ void HtmlDocVisitor::visit(DocInclude *inc) case DocInclude::HtmlInclude: m_t << inc->text(); break; + case DocInclude::LatexInclude: + break; case DocInclude::VerbInclude: forceEndParagraph(inc); m_t << /*PREFRAG_START <<*/ "<pre class=\"fragment\">"; @@ -1873,7 +1789,7 @@ void HtmlDocVisitor::visitPre(DocVhdlFlow *vf) m_t << "</a>"; if (vf->hasCaption()) { - m_t << "<br/>"; + m_t << "<br />"; } } } @@ -2040,7 +1956,7 @@ void HtmlDocVisitor::writeMscFile(const QCString &fileName, } void HtmlDocVisitor::writeDiaFile(const QCString &fileName, - const QCString &, + const QCString &relPath, const QCString &) { QCString baseName=fileName; @@ -2057,7 +1973,7 @@ void HtmlDocVisitor::writeDiaFile(const QCString &fileName, QCString outDir = Config_getString("HTML_OUTPUT"); writeDiaGraphFromFile(fileName,outDir,baseName,DIA_BITMAP); - m_t << "<img src=\"" << outDir << '/' << baseName << ".png" << "\" />" << endl; + m_t << "<img src=\"" << relPath << baseName << ".png" << "\" />" << endl; } /** Used for items found inside a paragraph, which due to XHTML restrictions @@ -2092,7 +2008,7 @@ void HtmlDocVisitor::forceEndParagraph(DocNode *n) //printf("forceEnd first=%d last=%d\n",isFirst,isLast); if (isFirst && isLast) return; - m_t << "</p>" << endl; + m_t << "</p>"; } } |