Skip to content

Commit e20ccb9

Browse files
committed
issue doxygen#12183 [REGRESSION] Hyperlink doesn't work in the <return value> field for @RetVal command
1 parent 50736cb commit e20ccb9

3 files changed

Lines changed: 25 additions & 15 deletions

File tree

src/docnode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3332,7 +3332,7 @@ Token DocParamList::parse(const QCString &cmdName)
33323332
parser()->checkRetvalName();
33333333
}
33343334
context.inSeeBlock=true;
3335-
parser()->handleLinkedWord(thisVariant(),m_params,m_type==DocParamSect::Param);
3335+
parser()->handleLinkedWord(thisVariant(),m_params,m_type==DocParamSect::Param,true);
33363336
context.inSeeBlock=false;
33373337
tok=tokenizer.lex();
33383338
}

src/docparser.cpp

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -844,7 +844,7 @@ void DocParser::handleUnclosedStyleCommands()
844844
}
845845
}
846846

847-
void DocParser::handleLinkedWord(DocNodeVariant *parent,DocNodeList &children,bool ignoreAutoLinkFlag)
847+
void DocParser::handleLinkedWord(DocNodeVariant *parent,DocNodeList &children,bool ignoreAutoLinkFlag,bool typeLinkOnly)
848848
{
849849
// helper to check if word w starts with any of the words in AUTOLINK_IGNORE_WORDS
850850
auto ignoreWord = [](const QCString &w) -> bool {
@@ -879,21 +879,31 @@ void DocParser::handleLinkedWord(DocNodeVariant *parent,DocNodeList &children,bo
879879
)
880880
)
881881
{
882-
//printf("ADD %s = %p (linkable?=%d)\n",qPrint(context.token->name),(void*)member,member ? member->isLinkable() : FALSE);
883-
if (member && member->isLinkable()) // member link
882+
//printf("ADD %s = %p (linkable?=%d typeLinkOnly=%d)\n",
883+
// qPrint(context.token->name),(void*)member,member ? member->isLinkable() : FALSE, typeLinkOnly);
884+
if (member && member->isLinkable())
884885
{
885-
AUTO_TRACE_ADD("resolved reference as member link");
886-
if (member->isObjCMethod())
886+
if (!typeLinkOnly || context.token->name.startsWith("#") ||
887+
member->isTypedef() || member->isEnumerate() || member->isEnumValue()) // filter on type links
887888
{
888-
bool localLink = context.memberDef ? member->getClassDef()==context.memberDef->getClassDef() : FALSE;
889-
name = member->objCMethodName(localLink,inSeeBlock);
889+
AUTO_TRACE_ADD("resolved reference as member link");
890+
if (member->isObjCMethod())
891+
{
892+
bool localLink = context.memberDef ? member->getClassDef()==context.memberDef->getClassDef() : FALSE;
893+
name = member->objCMethodName(localLink,inSeeBlock);
894+
}
895+
children.append<DocLinkedWord>(
896+
this,parent,name,
897+
member->getReference(),
898+
member->getOutputFileBase(),
899+
member->anchor(),
900+
member->briefDescriptionAsTooltip());
901+
}
902+
else // explicit type link, but not a type
903+
{
904+
AUTO_TRACE_ADD("no link as request is type but member is not a type or explicit link");
905+
children.append<DocWord>(this,parent,context.token->name);
890906
}
891-
children.append<DocLinkedWord>(
892-
this,parent,name,
893-
member->getReference(),
894-
member->getOutputFileBase(),
895-
member->anchor(),
896-
member->briefDescriptionAsTooltip());
897907
}
898908
else if (compound->isLinkable()) // compound link
899909
{

src/docparser_p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class DocParser : public IDocParser
138138
void handleInitialStyleCommands(DocNodeVariant *parent,DocNodeList &children);
139139
Token handleAHref(DocNodeVariant *parent,DocNodeList &children,const HtmlAttribList &tagHtmlAttribs);
140140
void handleUnclosedStyleCommands();
141-
void handleLinkedWord(DocNodeVariant *parent,DocNodeList &children,bool ignoreAutoLinkFlag=FALSE);
141+
void handleLinkedWord(DocNodeVariant *parent,DocNodeList &children,bool ignoreAutoLinkFlag=FALSE,bool typeLinkOnly=false);
142142
void handleParameterType(DocNodeVariant *parent,DocNodeList &children,const QCString &paramTypes);
143143
void handleInternalRef(DocNodeVariant *parent,DocNodeList &children);
144144
void handleAnchor(DocNodeVariant *parent,DocNodeList &children);

0 commit comments

Comments
 (0)