summaryrefslogtreecommitdiff
path: root/src/qdoc/quoter.cpp
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@qt.io>2019-04-02 09:46:30 +0200
committerKai Koehne <kai.koehne@qt.io>2019-04-02 11:55:53 +0000
commitb8a6084861456f5448c0fd0c22e0192e83ffb5f0 (patch)
treeb752d1e15677da9df7555914d941635914d09cbf /src/qdoc/quoter.cpp
parentebda25ecb40aa1a13920a534bf2c6449981b92fe (diff)
downloadqttools-b8a6084861456f5448c0fd0c22e0192e83ffb5f0.tar.gz
qdoc: Add support for CMake comments
CMake uses # as a line comment marker. To detect CMake files we check for the suffix .cmake, or check whether the filename is "CMakeLists.txt". See also https://cmake.org/cmake/help/latest/manual/cmake-language.7.html [ChangeLog][qdoc] qdoc now uses #! as a snippet marker in .cmake, CMakeLists.txt files. Task-number: QTBUG-73058 Change-Id: I230b113f0d49dd487b0f1926c815295a8a660a27 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src/qdoc/quoter.cpp')
-rw-r--r--src/qdoc/quoter.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qdoc/quoter.cpp b/src/qdoc/quoter.cpp
index 397caf085..408b1b5b0 100644
--- a/src/qdoc/quoter.cpp
+++ b/src/qdoc/quoter.cpp
@@ -112,7 +112,7 @@ Quoter::Quoter()
/* We're going to hard code these delimiters:
* C++, Qt, Qt Script, Java:
//! [<id>]
- * .pro, .py files:
+ * .pro, .py, CMake files:
#! [<id>]
* .html, .qrc, .ui, .xq, .xml .dita files:
<!-- [<id>] -->
@@ -120,6 +120,7 @@ Quoter::Quoter()
if (!commentHash.size()) {
commentHash["pro"] = "#!";
commentHash["py"] = "#!";
+ commentHash["cmake"] = "#!";
commentHash["html"] = "<!--";
commentHash["qrc"] = "<!--";
commentHash["ui"] = "<!--";
@@ -339,8 +340,10 @@ void Quoter::failedAtEnd( const Location& docLocation, const QString& command )
QString Quoter::commentForCode() const
{
- QString suffix = QFileInfo(codeLocation.fileName()).suffix();
- return commentHash.value(suffix, "//!");
+ QFileInfo fi = QFileInfo(codeLocation.fileName());
+ if (fi.fileName() == "CMakeLists.txt")
+ return "#!";
+ return commentHash.value(fi.suffix(), "//!");
}
QString Quoter::removeSpecialLines(const QString &line, const QString &comment, int unindent)