@@ -967,7 +967,7 @@ void HtmlDocVisitor::operator()(const DocCite &cite)
967967 if (!cite.file ().isEmpty ())
968968 {
969969 if (!opt.noCite ()) startLink (cite.ref (),cite.file (),cite.relPath (),cite.anchor ());
970- filter (cite.getText ());
970+ filter (cite.getText (), false , true );
971971 if (!opt.noCite ()) endLink ();
972972 }
973973 else
@@ -2153,10 +2153,12 @@ void HtmlDocVisitor::operator()(const DocParBlock &pb)
21532153 visitChildren (pb);
21542154}
21552155
2156- void HtmlDocVisitor::filter (const QCString &str, const bool retainNewline)
2156+ void HtmlDocVisitor::filter (const QCString &str, const bool retainNewline, const bool citeEntry )
21572157{
21582158 if (str.isEmpty ()) return ;
21592159 const char *p=str.data ();
2160+ const char *q = nullptr ;
2161+ int cnt = 0 ;
21602162 while (*p)
21612163 {
21622164 char c=*p++;
@@ -2165,7 +2167,37 @@ void HtmlDocVisitor::filter(const QCString &str, const bool retainNewline)
21652167 case ' \n ' : if (retainNewline) m_t << " <br/>" ; m_t << c; break ;
21662168 case ' <' : m_t << " <" ; break ;
21672169 case ' >' : m_t << " >" ; break ;
2168- case ' &' : m_t << " &" ; break ;
2170+ case ' &' : // possibility to have a special symbol
2171+ if (!citeEntry) {m_t << " &" ; break ;}
2172+ q = p;
2173+ cnt = 2 ; // we have to count & and ; as well
2174+ while ((*q >= ' a' && *q <= ' z' ) || (*q >= ' A' && *q <= ' Z' ) || (*q >= ' 0' && *q <= ' 9' ))
2175+ {
2176+ cnt++;
2177+ q++;
2178+ }
2179+ if (*q == ' ;' )
2180+ {
2181+ --p; // we need & as well
2182+ HtmlEntityMapper::SymType res = HtmlEntityMapper::instance ().name2sym (QCString (p).left (cnt));
2183+ if (res == HtmlEntityMapper::Sym_Unknown)
2184+ {
2185+ p++;
2186+ m_t << " &" ;
2187+ }
2188+ else
2189+ {
2190+ m_t << HtmlEntityMapper::instance ().html (res);
2191+ q++;
2192+ p = q;
2193+ }
2194+ }
2195+ else
2196+ {
2197+ m_t << " &" ;
2198+ }
2199+ break ;
2200+
21692201 case ' \\ ' :
21702202 if ((*p == ' (' ) || (*p == ' )' ) || (*p == ' [' ) || (*p == ' ]' ))
21712203 m_t << " \\ ‍" << *p++;
0 commit comments