diff options
-rw-r--r-- | src/qdoc/doc/qdoc-manual-markupcmds.qdoc | 5 | ||||
-rw-r--r-- | src/qdoc/quoter.cpp | 9 |
2 files changed, 11 insertions, 3 deletions
diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc index 1b6648f90..22b0b4e6b 100644 --- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -1767,6 +1767,11 @@ ... \endcode + By default, qdoc looks for \c{//!} as a code snippet marker. + For \c{.pro}, \c{.py}, \c{.cmake}, and \c{CMakeLists.txt} + files, \c {#!} is detected. Finally, \c{<!--} is accepted in + \c{.html}, \c{.qrc}, \c{.ui}, \c{.xml}, \c{.dita}, and \c{.xq} files. + \target codeline-command \section1 \\codeline 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) |