summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2019-06-22 10:44:09 (GMT)
committerGitHub <noreply@github.com>2019-06-22 10:44:09 (GMT)
commit8e19ed1c20261572d305503236a6d4299beee34a (patch)
treea2132fe3f1a3074977347069dc39e29b168999fa /src
parente0937f32cab960bf91f489360825b0eff297383a (diff)
parent313cc456d52ccf41f7b32adc3d0400cb7992549d (diff)
downloadDoxygen-8e19ed1c20261572d305503236a6d4299beee34a.zip
Doxygen-8e19ed1c20261572d305503236a6d4299beee34a.tar.gz
Doxygen-8e19ed1c20261572d305503236a6d4299beee34a.tar.bz2
Merge pull request #7034 from albert-github/feature/issue_7033
issue #7033 Syntax highlighting doesn't work when calling \dontinclude from Markdown files
Diffstat (limited to 'src')
-rw-r--r--src/docbookvisitor.cpp6
-rw-r--r--src/htmldocvisitor.cpp6
-rw-r--r--src/latexdocvisitor.cpp6
-rw-r--r--src/mandocvisitor.cpp6
-rw-r--r--src/rtfdocvisitor.cpp6
-rw-r--r--src/util.cpp8
-rw-r--r--src/util.h1
-rw-r--r--src/xmldocvisitor.cpp6
8 files changed, 33 insertions, 12 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index 64425c6..73db25f 100644
--- a/src/docbookvisitor.cpp
+++ b/src/docbookvisitor.cpp
@@ -472,7 +472,9 @@ DB_VIS_C
pushEnabled();
m_hide = TRUE;
}
- SrcLangExt langExt = getLanguageFromFileName(m_langExt);
+ QCString locLangExt = getFileNameExtension(op->includeFileName());
+ if (locLangExt.isEmpty()) locLangExt = m_langExt;
+ SrcLangExt langExt = getLanguageFromFileName(locLangExt);
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
@@ -485,7 +487,7 @@ DB_VIS_C
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getParser(m_langExt)
+ Doxygen::parserManager->getParser(locLangExt)
->parseCode(m_ci,op->context(),
op->text(),langExt,op->isExample(),
op->exampleFile(),
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index e7d9d57..29298a1 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -784,7 +784,9 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide=TRUE;
}
- SrcLangExt langExt = getLanguageFromFileName(m_langExt);
+ QCString locLangExt = getFileNameExtension(op->includeFileName());
+ if (locLangExt.isEmpty()) locLangExt = m_langExt;
+ SrcLangExt langExt = getLanguageFromFileName(locLangExt);
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
@@ -796,7 +798,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
QFileInfo cfi( op->includeFileName() );
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getParser(m_langExt)
+ Doxygen::parserManager->getParser(locLangExt)
->parseCode(
m_ci,
op->context(),
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index 2e979bd..f960333 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -566,7 +566,9 @@ void LatexDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide = TRUE;
}
- SrcLangExt langExt = getLanguageFromFileName(m_langExt);
+ QCString locLangExt = getFileNameExtension(op->includeFileName());
+ if (locLangExt.isEmpty()) locLangExt = m_langExt;
+ SrcLangExt langExt = getLanguageFromFileName(locLangExt);
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
@@ -579,7 +581,7 @@ void LatexDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getParser(m_langExt)
+ Doxygen::parserManager->getParser(locLangExt)
->parseCode(m_ci,op->context(),op->text(),langExt,
op->isExample(),op->exampleFile(),
fd, // fileDef
diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp
index 5c98c6f..e407642 100644
--- a/src/mandocvisitor.cpp
+++ b/src/mandocvisitor.cpp
@@ -367,7 +367,9 @@ void ManDocVisitor::visit(DocInclude *inc)
void ManDocVisitor::visit(DocIncOperator *op)
{
- SrcLangExt langExt = getLanguageFromFileName(m_langExt);
+ QCString locLangExt = getFileNameExtension(op->includeFileName());
+ if (locLangExt.isEmpty()) locLangExt = m_langExt;
+ SrcLangExt langExt = getLanguageFromFileName(locLangExt);
//printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",
// op->type(),op->isFirst(),op->isLast(),op->text().data());
if (op->isFirst())
@@ -393,7 +395,7 @@ void ManDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getParser(m_langExt)
+ Doxygen::parserManager->getParser(locLangExt)
->parseCode(m_ci,op->context(),op->text(),langExt,
op->isExample(),op->exampleFile(),
fd, // fileDef
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index 55c03a5..040375d 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -532,7 +532,9 @@ void RTFDocVisitor::visit(DocIncOperator *op)
//printf("DocIncOperator: type=%d first=%d, last=%d text=`%s'\n",
// op->type(),op->isFirst(),op->isLast(),op->text().data());
DBG_RTF("{\\comment RTFDocVisitor::visit(DocIncOperator)}\n");
- SrcLangExt langExt = getLanguageFromFileName(m_langExt);
+ QCString locLangExt = getFileNameExtension(op->includeFileName());
+ if (locLangExt.isEmpty()) locLangExt = m_langExt;
+ SrcLangExt langExt = getLanguageFromFileName(locLangExt);
if (op->isFirst())
{
if (!m_hide)
@@ -556,7 +558,7 @@ void RTFDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getParser(m_langExt)
+ Doxygen::parserManager->getParser(locLangExt)
->parseCode(m_ci,op->context(),op->text(),langExt,
op->isExample(),op->exampleFile(),
fd, // fileDef
diff --git a/src/util.cpp b/src/util.cpp
index 8b547a6..457c525 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -7434,6 +7434,14 @@ SrcLangExt getLanguageFromFileName(const QCString& fileName)
return SrcLangExt_Cpp; // not listed => assume C-ish language.
}
+QCString getFileNameExtension(QCString fn)
+{
+ if (fn.isEmpty()) return "";
+ int lastDot = fn.findRev('.');
+ if (lastDot!=-1) return fn.mid(lastDot);
+ return "";
+}
+
//--------------------------------------------------------------------------
MemberDef *getMemberFromSymbol(const Definition *scope,const FileDef *fileScope,
diff --git a/src/util.h b/src/util.h
index 1cd7c9d..81a3b0b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -389,6 +389,7 @@ QCString stripLeadingAndTrailingEmptyLines(const QCString &s,int &docLine);
bool updateLanguageMapping(const QCString &extension,const QCString &parser);
SrcLangExt getLanguageFromFileName(const QCString& fileName);
+QCString getFileNameExtension(QCString fn);
void initDefaultExtensionMapping();
void addCodeOnlyMappings();
diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp
index 1005719..0f11315 100644
--- a/src/xmldocvisitor.cpp
+++ b/src/xmldocvisitor.cpp
@@ -415,7 +415,9 @@ void XmlDocVisitor::visit(DocIncOperator *op)
pushEnabled();
m_hide = TRUE;
}
- SrcLangExt langExt = getLanguageFromFileName(m_langExt);
+ QCString locLangExt = getFileNameExtension(op->includeFileName());
+ if (locLangExt.isEmpty()) locLangExt = m_langExt;
+ SrcLangExt langExt = getLanguageFromFileName(locLangExt);
if (op->type()!=DocIncOperator::Skip)
{
popEnabled();
@@ -428,7 +430,7 @@ void XmlDocVisitor::visit(DocIncOperator *op)
fd = createFileDef( cfi.dirPath().utf8(), cfi.fileName().utf8() );
}
- Doxygen::parserManager->getParser(m_langExt)
+ Doxygen::parserManager->getParser(locLangExt)
->parseCode(m_ci,op->context(),
op->text(),langExt,op->isExample(),
op->exampleFile(),