Skip to content

Commit 38e5664

Browse files
committed
Join sequences of the same type of xref items together in a single paragraph (restores 1.8.16 behavior)
1 parent 4372054 commit 38e5664

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

src/commentscan.l

+11-9
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ enum class CommandSpacing
148148
{
149149
Invisible, // command sets some property but does not appear in the output.
150150
Inline, // command appears inline in the output which can be a brief description.
151-
Block // command starts a new paragraphs / ends a brief description.
151+
Block, // command starts a new paragraphs / ends a brief description.
152+
XRef // command is a cross reference (todo, bug, test, xrefitem).
152153
};
153154

154155
struct DocCmdMap
@@ -170,7 +171,7 @@ static const std::map< std::string, DocCmdMap > docCmdMap =
170171
{ "author", { 0, CommandSpacing::Block }},
171172
{ "authors", { 0, CommandSpacing::Block }},
172173
{ "brief", { &handleBrief, CommandSpacing::Invisible }},
173-
{ "bug", { &handleBug, CommandSpacing::Block }},
174+
{ "bug", { &handleBug, CommandSpacing::XRef }},
174175
{ "callergraph", { &handleCallergraph, CommandSpacing::Invisible }},
175176
{ "callgraph", { &handleCallgraph, CommandSpacing::Invisible }},
176177
{ "category", { &handleCategory, CommandSpacing::Invisible }},
@@ -283,10 +284,10 @@ static const std::map< std::string, DocCmdMap > docCmdMap =
283284
{ "subsection", { &handleSection, CommandSpacing::Block }},
284285
{ "subsubsection", { &handleSection, CommandSpacing::Block }},
285286
{ "tableofcontents", { &handleToc, CommandSpacing::Invisible }},
286-
{ "test", { &handleTest, CommandSpacing::Block }},
287+
{ "test", { &handleTest, CommandSpacing::XRef }},
287288
{ "throw", { 0, CommandSpacing::Block }},
288289
{ "throws", { 0, CommandSpacing::Block }},
289-
{ "todo", { &handleTodo, CommandSpacing::Block }},
290+
{ "todo", { &handleTodo, CommandSpacing::XRef }},
290291
{ "tparam", { 0, CommandSpacing::Block }},
291292
{ "typedef", { &handleFn, CommandSpacing::Invisible }},
292293
{ "union", { &handleUnion, CommandSpacing::Invisible }},
@@ -299,7 +300,7 @@ static const std::map< std::string, DocCmdMap > docCmdMap =
299300
{ "weakgroup", { &handleWeakGroup, CommandSpacing::Invisible }},
300301
{ "xmlinclude", { 0, CommandSpacing::Inline }},
301302
{ "xmlonly", { &handleFormatBlock, CommandSpacing::Invisible }},
302-
{ "xrefitem", { &handleXRefItem, CommandSpacing::Block }}
303+
{ "xrefitem", { &handleXRefItem, CommandSpacing::XRef }}
303304
};
304305

305306
#define YY_NO_INPUT 1
@@ -2831,28 +2832,29 @@ static void addXRefItem(yyscan_t yyscanner,
28312832

28322833
RefList *refList = RefListManager::instance().add(listName,listTitle,itemTitle);
28332834
RefItem *item = 0;
2834-
for (RefItem *i : yyextra->current->sli)
2835+
for (auto it = yyextra->current->sli.rbegin(); it != yyextra->current->sli.rend(); ++it)
28352836
{
2837+
RefItem *i = *it;
28362838
if (i && qstrcmp(i->list()->listName(),listName)==0)
28372839
{
2838-
//printf("found %s lii->type=%s\n",listName,lii->type);
2840+
//printf("found %s lii->type=%s\n",listName,i->list()->listName().data());
28392841
item = i;
28402842
break;
28412843
}
28422844
}
28432845
if (item && append) // already found item of same type just before this one
28442846
{
2845-
//printf("listName=%s item id = %d existing\n",listName,lii->itemId);
2847+
//printf("listName=%s item id = %d existing\n",listName,item->id());
28462848
item->setText(item->text() + " <p>" + yyextra->outputXRef);
28472849
//printf("%s: text +=%s\n",listName,item->text.data());
28482850
}
28492851
else // new item
28502852
{
2851-
//printf("listName=%s item id = %d new yyextra->current=%p\n",listName,itemId,yyextra->current);
28522853

28532854
// if we have already an item from the same list type (e.g. a second @todo)
28542855
// in the same Entry (i.e. lii!=0) then we reuse its link anchor.
28552856
item = refList->add();
2857+
//printf("listName=%s item id = %d new yyextra->current=%p\n",listName,item->id(),yyextra->current);
28562858
QCString anchorLabel;
28572859
anchorLabel.sprintf("_%s%06d",listName,item->id());
28582860
item->setText(yyextra->outputXRef);

0 commit comments

Comments
 (0)