diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2019-07-12 15:07:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-12 15:07:06 (GMT) |
commit | b118de2f38cfcb91888db571b5d9fd1a85731cd5 (patch) | |
tree | 7206a8412453da86dcd2a392615f15024a9fd9cf | |
parent | 34c9bac4624c5b94172af4a9d9168a44482fe552 (diff) | |
parent | 554974acf20aae4f31f87a55a3d3d3649b9a1aee (diff) | |
download | Doxygen-b118de2f38cfcb91888db571b5d9fd1a85731cd5.zip Doxygen-b118de2f38cfcb91888db571b5d9fd1a85731cd5.tar.gz Doxygen-b118de2f38cfcb91888db571b5d9fd1a85731cd5.tar.bz2 |
Merge pull request #7121 from albert-github/feature/issue_7120
issue #7120 Markdown generator does not consider extension mapping for files with no extension
-rw-r--r-- | src/util.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/util.cpp b/src/util.cpp index 7107e83..bf02d7e 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -7418,20 +7418,16 @@ void addCodeOnlyMappings() SrcLangExt getLanguageFromFileName(const QCString& fileName) { - int i = fileName.findRev('.'); - if (i!=-1) // name has an extension - { - QCString extStr=fileName.right(fileName.length()-i).lower(); - if (!extStr.isEmpty()) // non-empty extension + QFileInfo fi(fileName); + QCString extName = fi.extension().lower().data(); + if (extName.isEmpty()) extName=".no_extension"; + if (extName.at(0)!='.') extName.prepend("."); + int *pVal=g_extLookup.find(extName.data()); + if (pVal) // listed extension { - int *pVal=g_extLookup.find(extStr); - if (pVal) // listed extension - { - //printf("getLanguageFromFileName(%s)=%x\n",extStr.data(),*pVal); - return (SrcLangExt)*pVal; - } + //printf("getLanguageFromFileName(%s)=%x\n",fi.extension().data(),*pVal); + return (SrcLangExt)*pVal; } - } //printf("getLanguageFromFileName(%s) not found!\n",fileName.data()); return SrcLangExt_Cpp; // not listed => assume C-ish language. } |