#define CONFIG_LANGUAGE "language"
#define CONFIG_MACRO "macro"
#define CONFIG_NATURALLANGUAGE "naturallanguage"
+#define CONFIG_NOLINKERRORS "nolinkerrors"
#define CONFIG_OBSOLETELINKS "obsoletelinks"
#define CONFIG_OUTPUTDIR "outputdir"
#define CONFIG_OUTPUTENCODING "outputencoding"
QString myLink = getLink(atom, relative, &node);
if (myLink.isEmpty())
myLink = getCollisionLink(atom);
- if (myLink.isEmpty())
+ if (myLink.isEmpty() && !noLinkErrors())
relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
else if (!inSectionHeading_)
beginLink(myLink);
QStringList Generator::styleDirs;
QStringList Generator::styleFiles;
bool Generator::debugging_ = false;
+bool Generator::noLinkErrors_ = false;
void Generator::setDebugSegfaultFlag(bool b)
{
}
else
outputPrefixes[QLatin1String("QML")] = QLatin1String("qml-");
+ noLinkErrors_ = config.getBool(QLatin1String(CONFIG_NOLINKERRORS));
}
/*!
static void debugSegfault(const QString& message);
static void setDebugSegfaultFlag(bool b);
static bool debugging() { return debugging_; }
+ static bool noLinkErrors() { return noLinkErrors_; }
protected:
virtual void beginSubPage(const InnerNode* node, const QString& fileName);
static QStringList styleDirs;
static QStringList styleFiles;
static bool debugging_;
+ static bool noLinkErrors_;
void appendFullName(Text& text,
const Node *apparentNode,
QString myLink = getLink(atom, relative, &node);
if (myLink.isEmpty()) {
myLink = getCollisionLink(atom);
- if (myLink.isEmpty()) {
- relative->doc().location().warning(tr("Can't create link to '%1'")
- .arg(atom->string()));
+ if (myLink.isEmpty() && !noLinkErrors()) {
+ relative->doc().location().warning(tr("Can't link to '%1'").arg(atom->string()));
}
else
node = 0;
static bool highlighting = false;
static bool showInternal = false;
+static bool noLinkErrors = false;
static bool obsoleteLinks = false;
static QStringList defines;
static QStringList dependModules;
"Specify the directory where the output will be after running \"make install\"\n"
" -no-examples "
"Do not generate documentation for examples\n"
+ " -no-link-errors "
+ "Do not print link errors (i.e. missing targets)\n"
" -obsoletelinks "
"Report links from obsolete items to non-obsolete items\n"
" -outputdir "
}
config.setStringList(CONFIG_SYNTAXHIGHLIGHTING, QStringList(highlighting ? "true" : "false"));
config.setStringList(CONFIG_SHOWINTERNAL, QStringList(showInternal ? "true" : "false"));
+ config.setStringList(CONFIG_NOLINKERRORS, QStringList(noLinkErrors ? "true" : "false"));
config.setStringList(CONFIG_OBSOLETELINKS, QStringList(obsoleteLinks ? "true" : "false"));
/*
Config::overrideOutputFormats.insert(argv[i]);
i++;
}
+ else if (opt == "-no-link-errors") {
+ noLinkErrors = true;
+ }
else if (opt == "-debug") {
Generator::setDebugSegfaultFlag(true);
}
finds one, it sets \a ref and returns the found node.
*/
const Node*
-QDocDatabase::findUnambiguousTarget(const QString& target, QString& ref, const Node* relative) const
+QDocDatabase::findUnambiguousTarget(const QString& target, QString& ref, const Node* relative)
{
Target bestTarget;
int numBestTargets = 0;
QList<Target> bestTargetList;
- bool debug = false;
- if (target == "Manager" && Generator::debugging())
- debug = true;
-
QString key = Doc::canonicalTitle(target);
- TargetMultiMap::const_iterator i = targetMultiMap_.constFind(key);
- if (i != targetMultiMap_.constEnd()) {
- if (debug)
- qDebug() << "DEBUG: A";
- TargetMultiMap::const_iterator j = i;
- do {
- const Target& candidate = j.value();
- if (candidate.priority_ < bestTarget.priority_) {
- if (debug)
- qDebug() << "DEBUG: B";
- bestTarget = candidate;
- bestTargetList.clear();
- bestTargetList.append(candidate);
- numBestTargets = 1;
- } else if (candidate.priority_ == bestTarget.priority_) {
- if (debug)
- qDebug() << "DEBUG: C";
- bestTargetList.append(candidate);
- ++numBestTargets;
- }
- ++j;
- } while (j != targetMultiMap_.constEnd() && j.key() == i.key());
-
- if (debug)
- qDebug() << "DEBUG: D";
+ TargetMultiMap::iterator i = targetMultiMap_.find(key);
+ while (i != targetMultiMap_.end()) {
+ if (i.key() != key)
+ break;
+ const Target& candidate = i.value();
+ if (candidate.priority_ < bestTarget.priority_) {
+ bestTarget = candidate;
+ bestTargetList.clear();
+ bestTargetList.append(candidate);
+ numBestTargets = 1;
+ } else if (candidate.priority_ == bestTarget.priority_) {
+ bestTargetList.append(candidate);
+ ++numBestTargets;
+ }
+ ++i;
+ }
+ if (numBestTargets > 0) {
if (numBestTargets == 1) {
- if (debug)
- qDebug() << "DEBUG: E";
ref = bestTarget.ref_;
return bestTarget.node_;
}
else if (bestTargetList.size() > 1) {
- if (debug)
- qDebug() << "DEBUG: F";
if (relative && !relative->qmlModuleIdentifier().isEmpty()) {
- if (debug)
- qDebug() << "DEBUG: G";
for (int i=0; i<bestTargetList.size(); ++i) {
- if (debug)
- qDebug() << "DEBUG: H";
const Node* n = bestTargetList.at(i).node_;
- if (debug)
- qDebug() << "DEBUG: I";
if (n && relative->qmlModuleIdentifier() == n->qmlModuleIdentifier()) {
- if (debug)
- qDebug() << "DEBUG: J";
ref = bestTargetList.at(i).ref_;
return n;
}
}
}
}
- if (debug)
- qDebug() << "DEBUG: K";
+ ref.clear();
return 0;
}
}
const DocNode* findDocNodeByTitle(const QString& title, const Node* relative = 0) const;
- const Node *findUnambiguousTarget(const QString &target, QString& ref, const Node* relative) const;
+ const Node *findUnambiguousTarget(const QString &target, QString& ref, const Node* relative);
QString findTarget(const QString &target, const Node *node) const;
void resolveTargets(InnerNode* root);
NodeMultiMapMap newSinceMaps_;
NodeMapMap funcIndex_;
TextToNodeMap legaleseTexts_;
- TargetMultiMap targetMultiMap_;
DocNodeMultiMap docNodesByTitle_;
+ TargetMultiMap targetMultiMap_;
};
QT_END_NAMESPACE