diff options
author | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2020-02-11 12:32:47 +0100 |
---|---|---|
committer | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2020-02-14 14:27:21 +0100 |
commit | c555d3493f52c378707a40d824d70f369e0b4db9 (patch) | |
tree | 55c879e68256dd1e545e5641bd3d1b5eebe50f3b /src | |
parent | 26daab2554a55243a0cb6744346e1cfb27cfc3a9 (diff) |
qdoc: Extend \include command to include exampledirs
By default, qdoc supports \include files from the sourcedirs only.
It should also consider files to \include from the exampledirs, like
it does for the \snippet and \quotefromfile commands.
In addition, added a test to check if the \include works
for files exampledirs.
Change-Id: I9ce0b1905bfd0413022a4b4cab42588e4540e70e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/qdoc/config.cpp | 8 | ||||
-rw-r--r-- | src/qdoc/doc/qdoc-manual-markupcmds.qdoc | 16 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/qdoc/config.cpp b/src/qdoc/config.cpp index 55a23610b..934958910 100644 --- a/src/qdoc/config.cpp +++ b/src/qdoc/config.cpp @@ -724,8 +724,12 @@ QString Config::getIncludeFilePath(const QString &fileName) const if (!includeFilesMap_.contains(ext)) { QSet<QString> t; QStringList result; - const QStringList dirs = getCanonicalPathList(CONFIG_SOURCEDIRS); - for (const auto &dir : dirs) + const auto sourceDirs = getCanonicalPathList(CONFIG_SOURCEDIRS); + for (const auto &dir : sourceDirs) + result += getFilesHere(dir, ext, location(), t, t); + // Append the include files from the exampledirs as well + const auto exampleDirs = getCanonicalPathList(CONFIG_EXAMPLEDIRS); + for (const auto &dir : exampleDirs) result += getFilesHere(dir, ext, location(), t, t); includeFilesMap_.insert(ext, result); } diff --git a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc index 51aa3c2cc..fb178c7cc 100644 --- a/src/qdoc/doc/qdoc-manual-markupcmds.qdoc +++ b/src/qdoc/doc/qdoc-manual-markupcmds.qdoc @@ -3725,16 +3725,16 @@ The command is useful when some snippet of commands or text is to be used in multiple places in the documentation. Use the \\include command wherever you want to insert a snippet into the documentation. - The file containing the snippet to include must be located under the - path(s) listed in the \l{sourcedirs-variable}{sourcedirs} QDoc - configuration variable. It can be either any source file parsed - by QDoc (or even the same one where \\include command is used), or - any other text file. To store snippets in a separate file that is - not meant to be parsed by QDoc, use a file extension that is not - listed in \l {sources.fileextensions-variable}{sources.fileextensions}; + The file containing the snippet to include, must be located under the + path(s) listed in the \l{sourcedirs-variable}{sourcedirs} or + \l{exampledirs-variable}{exampledirs} QDoc configuration variable. + It can be either any source file parsed by QDoc (or even the same one + where \\include command is used), or any other text file. To store + snippets in a separate file that is not meant to be parsed by QDoc, + use a file extension that is not listed in + \l{sources.fileextensions-variable}{sources.fileextensions}; for example, \c .qdocinc. - The command can have either one or two arguments. The first argument is always a file name. The contents of the file must be QDoc input, in other words, a sequence of QDoc commands and text, but |