diff options
author | albert-github <albert.tests@gmail.com> | 2019-07-12 12:47:06 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2019-07-12 12:47:06 (GMT) |
commit | 554974acf20aae4f31f87a55a3d3d3649b9a1aee (patch) | |
tree | 7206a8412453da86dcd2a392615f15024a9fd9cf /src/util.cpp | |
parent | 34c9bac4624c5b94172af4a9d9168a44482fe552 (diff) | |
download | Doxygen-554974acf20aae4f31f87a55a3d3d3649b9a1aee.zip Doxygen-554974acf20aae4f31f87a55a3d3d3649b9a1aee.tar.gz Doxygen-554974acf20aae4f31f87a55a3d3d3649b9a1aee.tar.bz2 |
issue #7120 Markdown generator does not consider extension mapping for files with no extension
Better handling of the determination of what is an extension.
- don't see a file references like: `./LICENSE` as extension
- use the qt way of extension determination and in case of no extension use the no extension placeholder for it.
Diffstat (limited to 'src/util.cpp')
-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. } |