Skip to content

Commit 4539414

Browse files
committed
Merge branch 'albert-github-feature/bug_at_user'
2 parents 0922576 + f5fc652 commit 4539414

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

src/commentscan.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ class CommentScanner
115115
void leaveCompound(const QCString &fileName,int line,const QCString &name);
116116
void open(Entry *e,const QCString &fileName,int line,bool implicit=false);
117117
void close(Entry *e,const QCString &fileName,int line,bool foundInline,bool implicit=false);
118+
static bool isCommand(const QCString &cmdName);
118119
private:
119120
struct Private;
120121
std::unique_ptr<Private> p;

src/commentscan.l

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5175,4 +5175,10 @@ void CommentScanner::close(Entry *e,const QCString &fileName,int lineNr,bool fou
51755175
yyextra->docGroup.close(e,fileName,lineNr,foundInline,implicit);
51765176
}
51775177

5178+
bool CommentScanner::isCommand(const QCString &cmdName)
5179+
{
5180+
return (docCmdMap.find(cmdName.str()) != docCmdMap.end());
5181+
}
5182+
5183+
51785184
#include "commentscan.l.h"

src/markdown.cpp

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545
#include "doxygen.h"
4646
#include "commentscan.h"
4747
#include "entry.h"
48+
#include "commentcnv.h"
49+
#include "cmdmapper.h"
4850
#include "config.h"
4951
#include "message.h"
5052
#include "portable.h"
@@ -1240,6 +1242,7 @@ int Markdown::Private::processLink(const std::string_view data,size_t offset)
12401242
{
12411243
AUTO_TRACE("data='{}' offset={}",Trace::trunc(data),offset);
12421244
const size_t size = data.size();
1245+
12431246
QCString content;
12441247
QCString link;
12451248
QCString title;
@@ -1660,10 +1663,28 @@ int Markdown::Private::processLink(const std::string_view data,size_t offset)
16601663
out+=" ";
16611664
out+=externalLinkTarget();
16621665
out+=">";
1663-
content = content.simplifyWhiteSpace();
1666+
}
1667+
1668+
content = content.simplifyWhiteSpace();
1669+
bool foundNameRef = false;
1670+
if (!content.isEmpty() && (content.at(0)=='#' || content.at(0)=='@'))
1671+
{
1672+
size_t endOfId=1;
1673+
while (endOfId<content.length() && isId(content.at(endOfId))) endOfId++;
1674+
QCString user = content.mid(1,endOfId-1);
1675+
if (!user.isEmpty() && (content.at(0)=='#' || (!CommentScanner::isCommand(user) && Mappers::cmdMapper->map(user)==CommandType::UNKNOWN)))
1676+
{
1677+
// assume @name or #name instead of command
1678+
out+='@';
1679+
out+=content;
1680+
foundNameRef = true;
1681+
}
1682+
}
1683+
if (!foundNameRef)
1684+
{
16641685
processInline(std::string_view(content.str()));
1665-
out+="</a>";
16661686
}
1687+
out+="</a>";
16671688
}
16681689
else // avoid link to e.g. F[x](y)
16691690
{

0 commit comments

Comments
 (0)