qdoc: Enable listing of example files with .html extension

If a (non-external) link string ends in '.html', qdoc assumed it is
a direct link to a generated html page. However, it could also refer
to an example file with .html extension.

This commit fixes a corner case where links to an example file page
were broken for such files.

Task-number: QTBUG-40831
Change-Id: I31acc141970b6768f0a93964723be82611d37a3d
Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
bb10
Topi Reinio 2014-08-22 10:04:10 +02:00 committed by Topi Reiniö
parent d28e2e225c
commit 15c32361d9
2 changed files with 6 additions and 2 deletions

View File

@ -316,7 +316,7 @@ QString Generator::fileBase(const Node *node) const
QString base;
if (node->isDocNode()) {
base = node->name();
if (base.endsWith(".html"))
if (base.endsWith(".html") && !node->isExampleFile())
base.truncate(base.length() - 5);
if (node->isExample() || node->isExampleFile()) {

View File

@ -1627,8 +1627,12 @@ const Node* QDocDatabase::findNodeForAtom(const Atom* atom, const Node* relative
}
}
else {
if (first.endsWith(".html"))
if (first.endsWith(".html")) {
node = findNodeByNameAndType(QStringList(first), Node::Document);
// the path may also refer to an example file with .html extension
if (!node && first.contains("/"))
return findNodeForTarget(targetPath, relative, genus, ref);
}
else if (first.endsWith("()"))
node = findFunctionNode(first, relative, genus);
else {