From cbbd26b39cf63148b25d40498f0ab174e6094df7 Mon Sep 17 00:00:00 2001 From: albert-github Date: Mon, 30 Sep 2019 18:57:25 +0200 Subject: Bug 335614 - HTML link incorrect when using tagfile - See to it that when an extension is already present this extension is used and not a second extension is added - let the tag file know what the original extension was. --- src/definition.cpp | 2 +- src/filedef.cpp | 2 +- src/htmldocvisitor.cpp | 13 ++++++------- src/htmlgen.cpp | 27 ++++++++++++--------------- src/util.cpp | 13 +++++++++++++ src/util.h | 4 ++++ 6 files changed, 37 insertions(+), 24 deletions(-) diff --git a/src/definition.cpp b/src/definition.cpp index 3b5fea1..e972e6c 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -545,7 +545,7 @@ void DefinitionImpl::writeDocAnchorsToTagFile(FTextStream &tagFile) const { //printf("write an entry!\n"); if (definitionType()==TypeMember) tagFile << " "; - tagFile << " fileName << "\""; + tagFile << " fileName << (hasExtension(si->fileName) ? "" : Doxygen::htmlFileExtension) << "\""; if (!si->title.isEmpty()) { tagFile << " title=\"" << convertToXML(si->title) << "\""; diff --git a/src/filedef.cpp b/src/filedef.cpp index e4f6c86..e5e126c 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -349,7 +349,7 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile) tagFile << " " << endl; tagFile << " " << convertToXML(name()) << "" << endl; tagFile << " " << convertToXML(getPath()) << "" << endl; - tagFile << " " << convertToXML(getOutputFileBase()) << "" << endl; + tagFile << " " << convertToXML(getOutputFileBase()) << (hasExtension(getOutputFileBase()) ? "" : Doxygen::htmlFileExtension) << "" << endl; if (m_includeList && m_includeList->count()>0) { QListIterator ili(*m_includeList); diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 513c3a4..228880a 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -1913,11 +1913,7 @@ void HtmlDocVisitor::visitPre(DocSecRefItem *ref) { if (m_hide) return; QCString refName=ref->file(); - if (refName.right(Doxygen::htmlFileExtension.length())!= - QCString(Doxygen::htmlFileExtension)) - { - refName+=Doxygen::htmlFileExtension; - } + refName+=(hasExtension(refName) ? "" : Doxygen::htmlFileExtension); m_t << "
  • anchor() << "\">"; } @@ -2098,7 +2094,7 @@ void HtmlDocVisitor::visitPre(DocXRefItem *x) { m_t << "key()) << ">
    relPath() << x->file() << Doxygen::htmlFileExtension + << x->relPath() << x->file() << (hasExtension(x->file()) ? "" : Doxygen::htmlFileExtension) << "#" << x->anchor() << "\">"; } else @@ -2262,7 +2258,10 @@ void HtmlDocVisitor::startLink(const QCString &ref,const QCString &file, } m_t << "href=\""; m_t << externalRef(relPath,ref,TRUE); - if (!file.isEmpty()) m_t << file << Doxygen::htmlFileExtension; + if (!file.isEmpty()) + { + m_t << file << (hasExtension(file) ? "" : Doxygen::htmlFileExtension); + } if (!anchor.isEmpty()) m_t << "#" << anchor; m_t << "\""; if (!tooltip.isEmpty()) m_t << " title=\"" << convertToHtml(tooltip) << "\""; diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp index 402b4e4..1c46e4c 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -575,7 +575,7 @@ void HtmlCodeGenerator::_writeCodeLink(const char *className, } m_t << "href=\""; m_t << externalRef(m_relPath,ref,TRUE); - if (f) m_t << f << Doxygen::htmlFileExtension; + if (f) m_t << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension); if (anchor) m_t << "#" << anchor; m_t << "\""; if (tooltip) m_t << " title=\"" << convertToHtml(tooltip) << "\""; @@ -596,7 +596,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, { m_t << ""; } else @@ -1176,7 +1173,7 @@ void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, { t << "
  • "; if (path) docify(path); - t << ""; + t << ""; docify(name); t << " "; } @@ -1195,7 +1192,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f, } t << "href=\""; t << externalRef(relPath,ref,TRUE); - if (f) t << f << Doxygen::htmlFileExtension; + if (f) t << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension); if (anchor) t << "#" << anchor; t << "\">"; docify(name); @@ -1205,7 +1202,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f, void HtmlGenerator::startTextLink(const char *f,const char *anchor) { t << ""; } @@ -2369,7 +2366,7 @@ QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpa "\n"; } @@ -1116,13 +1115,12 @@ void HtmlGenerator::startFile(const char *name,const char *, m_sectionCount=0; } -void HtmlGenerator::writeSearchInfo(FTextStream &t,const QCString &relPath) +void HtmlGenerator::writeSearchInfo(FTextStream &t,const QCString &) { static bool searchEngine = Config_getBool(SEARCHENGINE); static bool serverBasedSearch = Config_getBool(SERVER_BASED_SEARCH); if (searchEngine && !serverBasedSearch) { - (void)relPath; t << "\n"; t << "
  • "; if (path) docify(path); - t << ""; + t << ""; docify(name); t << " "; } @@ -1369,8 +1367,8 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f, t << ""; docify(name); @@ -1380,7 +1378,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f, void HtmlGenerator::startTextLink(const char *f,const char *anchor) { t << ""; } @@ -1583,7 +1581,7 @@ static void endSectionContent(FTextStream &t) void HtmlGenerator::startClassDiagram() { - startSectionHeader(t,relPath,m_sectionCount); + startSectionHeader(t,m_relPath,m_sectionCount); } void HtmlGenerator::endClassDiagram(const ClassDiagram &d, @@ -1596,12 +1594,12 @@ void HtmlGenerator::endClassDiagram(const ClassDiagram &d, startSectionSummary(t,m_sectionCount); endSectionSummary(t); startSectionContent(t,m_sectionCount); - d.writeImage(tt,dir,relPath,fileName); + d.writeImage(tt,m_dir,m_relPath,fileName); if (!result.isEmpty()) { t << "
    " << endl; t << " \"\"/" << endl; t << " " << endl; t << " \"\"/" << endl; + t << m_relPath << fileName << ".png\" alt=\"\"/>" << endl; t << "
    "; } endSectionContent(t); @@ -1967,7 +1965,7 @@ void HtmlGenerator::endMemberDoc(bool hasArgs) void HtmlGenerator::startDotGraph() { - startSectionHeader(t,relPath,m_sectionCount); + startSectionHeader(t,m_relPath,m_sectionCount); } void HtmlGenerator::endDotGraph(DotClassGraph &g) @@ -1979,11 +1977,11 @@ void HtmlGenerator::endDotGraph(DotClassGraph &g) endSectionSummary(t); startSectionContent(t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,TRUE,m_sectionCount); + g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,TRUE,m_sectionCount); if (generateLegend && !umlLook) { t << "
    ["; - startHtmlLink(relPath+"graph_legend"+Doxygen::htmlFileExtension); + startHtmlLink(m_relPath+"graph_legend"+Doxygen::htmlFileExtension); t << theTranslator->trLegend(); endHtmlLink(); t << "]
    "; @@ -1995,7 +1993,7 @@ void HtmlGenerator::endDotGraph(DotClassGraph &g) void HtmlGenerator::startInclDepGraph() { - startSectionHeader(t,relPath,m_sectionCount); + startSectionHeader(t,m_relPath,m_sectionCount); } void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g) @@ -2005,7 +2003,7 @@ void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g) endSectionSummary(t); startSectionContent(t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount); + g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount); endSectionContent(t); m_sectionCount++; @@ -2013,7 +2011,7 @@ void HtmlGenerator::endInclDepGraph(DotInclDepGraph &g) void HtmlGenerator::startGroupCollaboration() { - startSectionHeader(t,relPath,m_sectionCount); + startSectionHeader(t,m_relPath,m_sectionCount); } void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g) @@ -2023,7 +2021,7 @@ void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g) endSectionSummary(t); startSectionContent(t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount); + g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount); endSectionContent(t); m_sectionCount++; @@ -2031,7 +2029,7 @@ void HtmlGenerator::endGroupCollaboration(DotGroupCollaboration &g) void HtmlGenerator::startCallGraph() { - startSectionHeader(t,relPath,m_sectionCount); + startSectionHeader(t,m_relPath,m_sectionCount); } void HtmlGenerator::endCallGraph(DotCallGraph &g) @@ -2041,7 +2039,7 @@ void HtmlGenerator::endCallGraph(DotCallGraph &g) endSectionSummary(t); startSectionContent(t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount); + g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount); endSectionContent(t); m_sectionCount++; @@ -2049,7 +2047,7 @@ void HtmlGenerator::endCallGraph(DotCallGraph &g) void HtmlGenerator::startDirDepGraph() { - startSectionHeader(t,relPath,m_sectionCount); + startSectionHeader(t,m_relPath,m_sectionCount); } void HtmlGenerator::endDirDepGraph(DotDirDeps &g) @@ -2059,7 +2057,7 @@ void HtmlGenerator::endDirDepGraph(DotDirDeps &g) endSectionSummary(t); startSectionContent(t,m_sectionCount); - g.writeGraph(t,GOF_BITMAP,EOF_Html,dir,fileName,relPath,TRUE,m_sectionCount); + g.writeGraph(t,GOF_BITMAP,EOF_Html,m_dir,m_fileName,m_relPath,TRUE,m_sectionCount); endSectionContent(t); m_sectionCount++; @@ -2067,7 +2065,7 @@ void HtmlGenerator::endDirDepGraph(DotDirDeps &g) void HtmlGenerator::writeGraphicalHierarchy(DotGfxHierarchyTable &g) { - g.writeGraph(t,dir,fileName); + g.writeGraph(t,m_dir,m_fileName); } void HtmlGenerator::startMemberGroupHeader(bool) @@ -2544,7 +2542,7 @@ QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpa "