qdoc: Avoid extra spaces in function synopses
Instead of blindly leading each parameter name with a space, check if the data type name is empty first. This prevents extra spaces from appearing in QML method signatures, which can be documented with parameter names only, without data types. Change-Id: I726f8c29839430186fcae4ac19d00404233395e0 Task-number: QTWEBSITE-691 Reviewed-by: Martin Smith <martin.smith@digia.com>bb10
parent
9684e16f00
commit
694d300355
|
|
@ -156,12 +156,13 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
|
|||
if (func->metaness() != FunctionNode::MacroWithoutParams) {
|
||||
synopsis += "(";
|
||||
if (!func->parameters().isEmpty()) {
|
||||
//synopsis += QLatin1Char(' ');
|
||||
QVector<Parameter>::ConstIterator p = func->parameters().constBegin();
|
||||
while (p != func->parameters().constEnd()) {
|
||||
if (p != func->parameters().constBegin())
|
||||
synopsis += ", ";
|
||||
synopsis += typified((*p).dataType());
|
||||
if (!(*p).dataType().isEmpty())
|
||||
synopsis += QLatin1Char(' ');
|
||||
if (style != Subpage && !(*p).name().isEmpty())
|
||||
synopsis +=
|
||||
"<@param>" + protect((*p).name()) + "</@param>";
|
||||
|
|
@ -170,7 +171,6 @@ QString CppCodeMarker::markedUpSynopsis(const Node *node,
|
|||
synopsis += " = " + protect((*p).defaultValue());
|
||||
++p;
|
||||
}
|
||||
//synopsis += QLatin1Char(' ');
|
||||
}
|
||||
synopsis += QLatin1Char(')');
|
||||
}
|
||||
|
|
@ -334,7 +334,7 @@ QString CppCodeMarker::markedUpQmlItem(const Node* node, bool summary)
|
|||
synopsis += ", ";
|
||||
synopsis += typified((*p).dataType());
|
||||
if (!(*p).name().isEmpty()) {
|
||||
if (!synopsis.endsWith(QLatin1Char('(')))
|
||||
if (!(*p).dataType().isEmpty())
|
||||
synopsis += QLatin1Char(' ');
|
||||
synopsis += "<@param>" + protect((*p).name()) + "</@param>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3150,7 +3150,7 @@ void HtmlGenerator::generateQmlItem(const Node *node,
|
|||
}
|
||||
marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
|
||||
"<i>\\1<sub>\\2</sub></i>");
|
||||
marked.replace("<@param>", "<i> ");
|
||||
marked.replace("<@param>", "<i>");
|
||||
marked.replace("</@param>", "</i>");
|
||||
|
||||
if (summary)
|
||||
|
|
@ -3390,7 +3390,7 @@ void HtmlGenerator::generateSynopsis(const Node *node,
|
|||
}
|
||||
marked.replace(QRegExp("<@param>([a-z]+)_([1-9n])</@param>"),
|
||||
"<i>\\1<sub>\\2</sub></i>");
|
||||
marked.replace("<@param>", "<i> ");
|
||||
marked.replace("<@param>", "<i>");
|
||||
marked.replace("</@param>", "</i>");
|
||||
|
||||
if (style == CodeMarker::Summary) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue