@@ -892,19 +892,7 @@ void HtmlCodeGenerator::_writeCodeLink(const QCString &className,
892892 *m_t << " <a class=\" " << className << " \" " ;
893893 }
894894 *m_t << " href=\" " ;
895- if (!ref.isEmpty ()) *m_t << externalRef (m_relPath,ref,TRUE );
896- if (!f.isEmpty ())
897- {
898- QCString fn = f;
899- addHtmlExtensionIfMissing (fn);
900- if (ref.isEmpty ())
901- {
902- if (!anchor.isEmpty () && (fileName () == fn)) fn = " " ;
903- else *m_t << externalRef (m_relPath,ref,TRUE );
904- }
905- *m_t << fn;
906- }
907- if (!anchor.isEmpty ()) *m_t << " #" << anchor;
895+ *m_t << createHtmlUrl (m_relPath,ref,true ,fileName (),f,anchor);
908896 *m_t << " \" " ;
909897 if (!tooltip.isEmpty ()) *m_t << " title=\" " << convertToHtml (tooltip) << " \" " ;
910898 *m_t << " >" ;
@@ -920,22 +908,11 @@ void HtmlCodeGenerator::writeTooltip(const QCString &id, const DocLinkInfo &docI
920908{
921909 *m_t << " <div class=\" ttc\" id=\" " << id << " \" >" ;
922910 *m_t << " <div class=\" ttname\" >" ;
923- QCString url = docInfo.url ;
924- addHtmlExtensionIfMissing (url);
925911 if (!docInfo.url .isEmpty ())
926912 {
927913 *m_t << " <a href=\" " ;
928- if (!docInfo.ref .isEmpty ()) *m_t << externalRef (m_relPath,docInfo.ref ,TRUE );
929- else
930- {
931- if (!docInfo.anchor .isEmpty () && (fileName () == url)) url = " " ;
932- else *m_t << externalRef (m_relPath,docInfo.ref ,TRUE );
933- }
934- *m_t << url;
935- if (!docInfo.anchor .isEmpty ())
936- {
937- *m_t << " #" << docInfo.anchor ;
938- }
914+ *m_t << createHtmlUrl (m_relPath,docInfo.ref ,true ,
915+ fileName (),docInfo.url ,docInfo.anchor );
939916 *m_t << " \" >" ;
940917 }
941918 docify (docInfo.name );
@@ -964,20 +941,9 @@ void HtmlCodeGenerator::writeTooltip(const QCString &id, const DocLinkInfo &docI
964941 *m_t << " <div class=\" ttdef\" ><b>" << theTranslator->trDefinition () << " </b> " ;
965942 if (!defInfo.url .isEmpty ())
966943 {
967- url = defInfo.url ;
968- addHtmlExtensionIfMissing (url);
969944 *m_t << " <a href=\" " ;
970- if (!defInfo.ref .isEmpty ()) *m_t << externalRef (m_relPath,defInfo.ref ,TRUE );
971- else
972- {
973- if (!defInfo.anchor .isEmpty () && (fileName () == url)) url = " " ;
974- else *m_t << externalRef (m_relPath,defInfo.ref ,TRUE );
975- }
976- *m_t << url;
977- if (!defInfo.anchor .isEmpty ())
978- {
979- *m_t << " #" << defInfo.anchor ;
980- }
945+ *m_t << createHtmlUrl (m_relPath,defInfo.ref ,true ,
946+ fileName (),defInfo.url ,defInfo.anchor );
981947 *m_t << " \" >" ;
982948 }
983949 *m_t << defInfo.file << " :" << defInfo.line ;
@@ -992,20 +958,9 @@ void HtmlCodeGenerator::writeTooltip(const QCString &id, const DocLinkInfo &docI
992958 *m_t << " <div class=\" ttdecl\" ><b>" << theTranslator->trDeclaration () << " </b> " ;
993959 if (!declInfo.url .isEmpty ())
994960 {
995- url = declInfo.url ;
996- addHtmlExtensionIfMissing (url);
997961 *m_t << " <a href=\" " ;
998- if (!declInfo.ref .isEmpty ()) *m_t << externalRef (m_relPath,declInfo.ref ,TRUE );
999- else
1000- {
1001- if (!declInfo.anchor .isEmpty () && (fileName () == url)) url = " " ;
1002- else *m_t << externalRef (m_relPath,declInfo.ref ,TRUE );
1003- }
1004- *m_t << url;
1005- if (!declInfo.anchor .isEmpty ())
1006- {
1007- *m_t << " #" << declInfo.anchor ;
1008- }
962+ *m_t << createHtmlUrl (m_relPath,declInfo.ref ,true ,
963+ fileName (),declInfo.url ,declInfo.anchor );
1009964 *m_t << " \" >" ;
1010965 }
1011966 *m_t << declInfo.file << " :" << declInfo.line ;
@@ -1749,19 +1704,10 @@ void HtmlGenerator::writeObjectLink(const QCString &ref,const QCString &f,
17491704 m_t << " <a class=\" el\" " ;
17501705 }
17511706 m_t << " href=\" " ;
1752- if (!ref.isEmpty ()) m_t << externalRef (m_relPath,ref,TRUE );
1753- if (!f.isEmpty ())
1754- {
1755- QCString fn = f;
1756- addHtmlExtensionIfMissing (fn);
1757- if (ref.isEmpty ())
1758- {
1759- if (!anchor.isEmpty () && (fileName () == Config_getString (HTML_OUTPUT) + " /" + fn)) fn = " " ;
1760- else m_t << externalRef (m_relPath,ref,TRUE );
1761- }
1762- m_t << fn;
1763- }
1764- if (!anchor.isEmpty ()) m_t << " #" << anchor;
1707+ QCString fn = f;
1708+ addHtmlExtensionIfMissing (fn);
1709+ m_t << createHtmlUrl (m_relPath,ref,true ,
1710+ Config_getString (HTML_OUTPUT)+" /" +fn,f,anchor);
17651711 m_t << " \" >" ;
17661712 docify (name);
17671713 m_t << " </a>" ;
@@ -1770,13 +1716,9 @@ void HtmlGenerator::writeObjectLink(const QCString &ref,const QCString &f,
17701716void HtmlGenerator::startTextLink (const QCString &f,const QCString &anchor)
17711717{
17721718 m_t << " <a href=\" " ;
1773- if (!f.isEmpty ())
1774- {
1775- QCString fn = f;
1776- addHtmlExtensionIfMissing (fn);
1777- if (anchor.isEmpty () || (fileName () != Config_getString (HTML_OUTPUT) + " /" + fn)) m_t << m_relPath << fn;
1778- }
1779- if (!anchor.isEmpty ()) m_t << " #" << anchor;
1719+ QCString fn = f;
1720+ addHtmlExtensionIfMissing (fn);
1721+ m_t << createHtmlUrl (" " ," " ,true ,Config_getString (HTML_OUTPUT)+" /" +fn,f,anchor);
17801722 m_t << " \" >" ;
17811723}
17821724
0 commit comments