diff options
-rw-r--r-- | src/definition.cpp | 2 | ||||
-rw-r--r-- | src/filedef.cpp | 2 | ||||
-rw-r--r-- | src/htmldocvisitor.cpp | 13 | ||||
-rw-r--r-- | src/htmlgen.cpp | 27 | ||||
-rw-r--r-- | src/util.cpp | 13 | ||||
-rw-r--r-- | src/util.h | 4 |
6 files changed, 37 insertions, 24 deletions
diff --git a/src/definition.cpp b/src/definition.cpp index e18932e..1912c46 100644 --- a/src/definition.cpp +++ b/src/definition.cpp @@ -532,7 +532,7 @@ void DefinitionImpl::writeDocAnchorsToTagFile(FTextStream &tagFile) const { //printf("write an entry!\n"); if (definitionType()==TypeMember) tagFile << " "; - tagFile << " <docanchor file=\"" << si->fileName << "\""; + tagFile << " <docanchor file=\"" << si->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 e028bab..6556372 100644 --- a/src/filedef.cpp +++ b/src/filedef.cpp @@ -349,7 +349,7 @@ void FileDefImpl::writeTagFile(FTextStream &tagFile) tagFile << " <compound kind=\"file\">" << endl; tagFile << " <name>" << convertToXML(name()) << "</name>" << endl; tagFile << " <path>" << convertToXML(getPath()) << "</path>" << endl; - tagFile << " <filename>" << convertToXML(getOutputFileBase()) << "</filename>" << endl; + tagFile << " <filename>" << convertToXML(getOutputFileBase()) << (hasExtension(getOutputFileBase()) ? "" : Doxygen::htmlFileExtension) << "</filename>" << endl; if (m_includeList && m_includeList->count()>0) { QListIterator<IncludeInfo> ili(*m_includeList); diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 6312a65..543d604 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 << "<li><a href=\"" << refName << "#" << ref->anchor() << "\">"; } @@ -2098,7 +2094,7 @@ void HtmlDocVisitor::visitPre(DocXRefItem *x) { m_t << "<dl" << getDirHtmlClassOfNode(getTextDirByConfig(x), x->key()) << "><dt><b><a class=\"el\" href=\"" - << x->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 41f0500..047eec8 100644 --- a/src/htmlgen.cpp +++ b/src/htmlgen.cpp @@ -752,7 +752,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) << "\""; @@ -773,7 +773,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, { m_t << "<a href=\""; m_t << externalRef(m_relPath,docInfo.ref,TRUE); - m_t << docInfo.url << Doxygen::htmlFileExtension; + m_t << docInfo.url << (hasExtension(docInfo.url) ? "" : Doxygen::htmlFileExtension); if (!docInfo.anchor.isEmpty()) { m_t << "#" << docInfo.anchor; @@ -805,7 +805,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, { m_t << "<a href=\""; m_t << externalRef(m_relPath,defInfo.ref,TRUE); - m_t << defInfo.url << Doxygen::htmlFileExtension; + m_t << defInfo.url << (hasExtension(docInfo.url) ? "" : Doxygen::htmlFileExtension); if (!defInfo.anchor.isEmpty()) { m_t << "#" << defInfo.anchor; @@ -826,7 +826,7 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo, { m_t << "<a href=\""; m_t << externalRef(m_relPath,declInfo.ref,TRUE); - m_t << declInfo.url << Doxygen::htmlFileExtension; + m_t << declInfo.url << (hasExtension(docInfo.url) ? "" : Doxygen::htmlFileExtension); if (!declInfo.anchor.isEmpty()) { m_t << "#" << declInfo.anchor; @@ -1090,10 +1090,7 @@ void HtmlGenerator::startFile(const char *name,const char *, lastTitle=title; relPath = relativePathToRoot(fileName); - if (fileName.right(Doxygen::htmlFileExtension.length())!=Doxygen::htmlFileExtension) - { - fileName+=Doxygen::htmlFileExtension; - } + fileName+=(hasExtension(fileName) ? "" : Doxygen::htmlFileExtension); startPlainFile(fileName); m_codeGen.setTextStream(t); m_codeGen.setRelativePath(relPath); @@ -1327,7 +1324,7 @@ void HtmlGenerator::startIndexItem(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); t << "\">"; } else @@ -1354,7 +1351,7 @@ void HtmlGenerator::writeStartAnnoItem(const char *,const char *f, { t << "<li>"; if (path) docify(path); - t << "<a class=\"el\" href=\"" << f << Doxygen::htmlFileExtension << "\">"; + t << "<a class=\"el\" href=\"" << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension) << "\">"; docify(name); t << "</a> "; } @@ -1373,7 +1370,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); @@ -1383,7 +1380,7 @@ void HtmlGenerator::writeObjectLink(const char *ref,const char *f, void HtmlGenerator::startTextLink(const char *f,const char *anchor) { t << "<a href=\""; - if (f) t << relPath << f << Doxygen::htmlFileExtension; + if (f) t << relPath << f << (hasExtension(f) ? "" : Doxygen::htmlFileExtension); if (anchor) t << "#" << anchor; t << "\">"; } @@ -2547,7 +2544,7 @@ QCString HtmlGenerator::writeSplitBarAsString(const char *name,const char *relpa "<script type=\"text/javascript\">\n" "/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&dn=gpl-2.0.txt GPL-v2 */\n" "$(document).ready(function(){initNavTree('") + - QCString(name) + Doxygen::htmlFileExtension + + QCString(name) + (hasExtension(name) ? "" : Doxygen::htmlFileExtension) + QCString("','") + relpath + QCString("'); initResizable(); });\n" "/* @license-end */\n" @@ -2985,7 +2982,7 @@ void HtmlGenerator::writeInheritedSectionTitle( classLink += "href=\""; classLink+=relPath; } - classLink+=file+Doxygen::htmlFileExtension+a; + classLink=classLink+file+(hasExtension(file) ? "" : Doxygen::htmlFileExtension)+a; classLink+=QCString("\">")+convertToHtml(name,FALSE)+"</a>"; t << "<tr class=\"inherit_header " << id << "\">" << "<td colspan=\"2\" onclick=\"javascript:toggleInherit('" << id << "')\">" @@ -3008,7 +3005,7 @@ void HtmlGenerator::writeSummaryLink(const char *file,const char *anchor,const c if (file) { t << relPath << file; - t << Doxygen::htmlFileExtension; + t << (hasExtension(file) ? "" : Doxygen::htmlFileExtension); } else { diff --git a/src/util.cpp b/src/util.cpp index 9c46516..d68ff52 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7089,6 +7089,19 @@ bool checkExtension(const char *fName, const char *ext) return (QCString(fName).right(QCString(ext).length())==ext); } +bool hasExtension(const char *fName) +{ + return !(QFileInfo(fName).extension(FALSE).isEmpty()); +} +bool hasExtension(QCString fName) +{ + return !(QFileInfo(fName).extension(FALSE).isEmpty()); +} +bool hasExtension(QString fName) +{ + return !(QFileInfo(fName).extension(FALSE).isEmpty()); +} + QCString stripExtensionGeneral(const char *fName, const char *ext) { QCString result=fName; @@ -364,6 +364,10 @@ QCString linkToText(SrcLangExt lang,const char *link,bool isFileName); bool checkExtension(const char *fName, const char *ext); +bool hasExtension(const char *fName); +bool hasExtension(QCString fName); +bool hasExtension(QString fName); + QCString stripExtensionGeneral(const char *fName, const char *ext); QCString stripExtension(const char *fName); |