Skip to content

Commit 81dc757

Browse files
committed
Fixed issue rendering Objective-C protocol classes in the HTML output
1 parent d443a5c commit 81dc757

File tree

2 files changed

+19
-13
lines changed

2 files changed

+19
-13
lines changed

src/ftvhelp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ void FTVHelp::addContentsItem(bool isDir,
194194
const QCString &nameAsHtml
195195
)
196196
{
197-
//printf("%p: p->indent=%d addContentsItem(%d,%s,%s,%s,%s)\n",(void*)this,p->indent,isDir,qPrint(name),qPrint(ref),qPrint(file),qPrint(anchor));
197+
//printf("%p: p->indent=%d addContentsItem(isDir=%d,name=%s,ref=%s,file=%s,anchor=%s,nameAsHtml=%s)\n",(void*)this,p->indent,isDir,qPrint(name),qPrint(ref),qPrint(file),qPrint(anchor),qPrint(nameAsHtml));
198198
auto &nl = p->indentNodes[p->indent];
199199
if (!nl.empty())
200200
{

src/index.cpp

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,8 @@ void addMembersToIndex(T *def,LayoutDocManager::LayoutPart part,
548548
def->getReference(),def->getOutputFileBase(),anchor,
549549
hasMembers && !preventSeparateIndex,
550550
addToIndex,
551-
def);
551+
def,
552+
convertToHtml(name));
552553
//printf("addMembersToIndex(def=%s hasMembers=%d numClasses=%d)\n",qPrint(def->name()),hasMembers,numClasses);
553554
if (hasMembers || numClasses>0 || numConcepts>0)
554555
{
@@ -649,6 +650,7 @@ static void writeClassTreeToOutput(OutputList &ol,const BaseClassList &bcl,int l
649650
//printf("Passed...\n");
650651
bool hasChildren = visitedClasses.find(cd)==visitedClasses.end() &&
651652
classHasVisibleChildren(cd);
653+
QCString escapedName = convertToHtml(cd->displayName()); // avoid objective-C '<Protocol>' to be interpreted as XML/HTML tag
652654
//printf("tree4: Has children %s: %d\n",qPrint(cd->name()),hasChildren);
653655
if (cd->isLinkable())
654656
{
@@ -658,7 +660,7 @@ static void writeClassTreeToOutput(OutputList &ol,const BaseClassList &bcl,int l
658660
cd->getDefLine(),
659661
cd,
660662
nullptr,
661-
cd->displayName(),
663+
escapedName,
662664
DocOptions()
663665
.setSingleLine(true)
664666
.setAutolinkSupport(false));
@@ -681,7 +683,7 @@ static void writeClassTreeToOutput(OutputList &ol,const BaseClassList &bcl,int l
681683
}
682684
else
683685
{
684-
ftv->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),cd->anchor(),FALSE,FALSE,cd);
686+
ftv->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),cd->anchor(),FALSE,FALSE,cd,escapedName);
685687
}
686688
}
687689
}
@@ -696,7 +698,7 @@ static void writeClassTreeToOutput(OutputList &ol,const BaseClassList &bcl,int l
696698
}
697699
if (ftv)
698700
{
699-
ftv->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE,cd);
701+
ftv->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE,cd,escapedName);
700702
}
701703
}
702704
if (hasChildren)
@@ -1027,6 +1029,7 @@ static void writeClassTreeForList(OutputList &ol,const ClassLinkedMap &cl,bool &
10271029
bool hasChildren = visitedClasses.find(cd.get())==visitedClasses.end() &&
10281030
classHasVisibleChildren(cd.get());
10291031
//printf("list: Has children %s: %d\n",qPrint(cd->name()),hasChildren);
1032+
QCString escapedName = convertToHtml(cd->displayName()); // avoid objective-C '<Protocol>' to be interpreted as XML/HTML tag
10301033
if (cd->isLinkable())
10311034
{
10321035
//printf("Writing class %s isLinkable()=%d isLinkableInProject()=%d cd->isImplicitTemplateinstance()=%d\n",
@@ -1036,7 +1039,7 @@ static void writeClassTreeForList(OutputList &ol,const ClassLinkedMap &cl,bool &
10361039
cd->getDefLine(),
10371040
cd.get(),
10381041
nullptr,
1039-
cd->displayName(),
1042+
escapedName,
10401043
DocOptions()
10411044
.setSingleLine(true)
10421045
.setAutolinkSupport(false));
@@ -1050,11 +1053,13 @@ static void writeClassTreeForList(OutputList &ol,const ClassLinkedMap &cl,bool &
10501053
if (addToIndex)
10511054
{
10521055
if (cd->getLanguage()!=SrcLangExt::VHDL) // prevents double insertion in Design Unit List
1053-
Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),cd->anchor(),FALSE,FALSE);
1056+
{
1057+
Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),cd->anchor(),FALSE,FALSE,cd.get(),escapedName);
1058+
}
10541059
}
10551060
if (ftv)
10561061
{
1057-
ftv->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),cd->anchor(),FALSE,FALSE,cd.get());
1062+
ftv->addContentsItem(hasChildren,cd->displayName(),cd->getReference(),cd->getOutputFileBase(),cd->anchor(),FALSE,FALSE,cd.get(),escapedName);
10581063
}
10591064
}
10601065
else
@@ -1064,11 +1069,11 @@ static void writeClassTreeForList(OutputList &ol,const ClassLinkedMap &cl,bool &
10641069
ol.endIndexItem(QCString(),QCString());
10651070
if (addToIndex)
10661071
{
1067-
Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE);
1072+
Doxygen::indexList->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE,cd.get(),escapedName);
10681073
}
10691074
if (ftv)
10701075
{
1071-
ftv->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE,cd.get());
1076+
ftv->addContentsItem(hasChildren,cd->displayName(),QCString(),QCString(),QCString(),FALSE,FALSE,cd.get(),escapedName);
10721077
}
10731078
}
10741079
if (cd->getLanguage()==SrcLangExt::VHDL && hasChildren)
@@ -1782,10 +1787,11 @@ static void writeClassTree(const ListType &cl,FTVHelp *ftv,bool addToIndex,bool
17821787
}
17831788
if (classVisibleInIndex(cd) && !cd->isImplicitTemplateInstance())
17841789
{
1790+
QCString displayName = cd->displayName(false);
17851791
if (ftv)
17861792
{
1787-
ftv->addContentsItem(count>0,cd->displayName(FALSE),cd->getReference(),
1788-
cd->getOutputFileBase(),cd->anchor(),FALSE,TRUE,cd);
1793+
ftv->addContentsItem(count>0,displayName,cd->getReference(),
1794+
cd->getOutputFileBase(),cd->anchor(),FALSE,TRUE,cd,convertToHtml(displayName));
17891795
}
17901796
if (addToIndex &&
17911797
(cd->getOuterScope()==nullptr ||
@@ -1794,7 +1800,7 @@ static void writeClassTree(const ListType &cl,FTVHelp *ftv,bool addToIndex,bool
17941800
)
17951801
{
17961802
addMembersToIndex(cd,LayoutDocManager::Class,
1797-
cd->displayName(FALSE),
1803+
displayName,
17981804
cd->anchor(),
17991805
cd->partOfGroups().empty() && !cd->isSimple());
18001806
}

0 commit comments

Comments
 (0)