diff options
author | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-04-21 13:56:37 (GMT) |
---|---|---|
committer | dimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7> | 2003-04-21 13:56:37 (GMT) |
commit | ebd0447bcc5d3d75214c847954bfda1d2e8c97f5 (patch) | |
tree | 3db0b381fb31e078de0540249c869667f44ec68d /src/htmldocvisitor.cpp | |
parent | 3cd2917eca7d09a30636b2b16efcd187bc3bf7c0 (diff) | |
download | Doxygen-ebd0447bcc5d3d75214c847954bfda1d2e8c97f5.zip Doxygen-ebd0447bcc5d3d75214c847954bfda1d2e8c97f5.tar.gz Doxygen-ebd0447bcc5d3d75214c847954bfda1d2e8c97f5.tar.bz2 |
Release-1.3-20030421
Diffstat (limited to 'src/htmldocvisitor.cpp')
-rw-r--r-- | src/htmldocvisitor.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 752ea43..353194b 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -272,6 +272,11 @@ void HtmlDocVisitor::visit(DocFormula *f) m_t << "\"middle\""; // assume Windows users use IE or HtmlHelp which on // displays formulas nicely with align == "middle" #endif + m_t << " alt=\""; + filterQuotedCdataAttr(f->text()); + m_t << "\""; + /// @todo cache image dimensions on formula generation and give height/width + /// for faster preloading and better rendering of the page m_t << " src=\"" << f->name() << ".png\">"; if (f->text().at(0)=='\\') m_t << endl << "</center><p>" << endl; @@ -921,6 +926,43 @@ void HtmlDocVisitor::filter(const char *str) } } +/// Escape basic entities to produce a valid CDATA attribute value, +/// assume that the outer quoting will be using the double quote " +void HtmlDocVisitor::filterQuotedCdataAttr(const char* str) +{ + if (str==0) return; + const char *p=str; + char c; + while (*p) + { + c=*p++; + switch(c) + { + case '&': m_t << "&"; break; + case '"': m_t << """; break; + // For SGML compliance, and given the SGML declaration for HTML syntax, + // it's enough to replace these two, provided that the declaration + // for the HTML version we generate (and as supported by the browser) + // specifies that all the other symbols used in rawVal are + // within the right charachter class (i.e., they're not + // some multinational weird charachters not in the BASESET). + // We assume that 1) the browser will support whatever is remaining + // in the formula and 2) the TeX formulae are generally governed + // by even stricter charachter restrictions so it should be enough. + // + // On some incompliant browsers, additional translation of + // '>' and '<' into ">" and "<", respectively, might be needed; + // but I'm unaware of particular modern (last 4 years) versions + // with such problems, so let's not do it for performance. + // Also, some brousers will (wrongly) not process the entity references + // inside the attribute value and show the &...; form instead, + // so we won't create entites unless necessary to minimize clutter there. + // --vassilii + default: m_t << c; + } + } +} + void HtmlDocVisitor::startLink(const QString &ref,const QString &file,const QString &anchor) { QCString *dest; |