Skip to content

Commit

Permalink
Bug 743367 - Duplicate attribute (target="_top" target="_top") genera…
Browse files Browse the repository at this point in the history
…ted in .SVG files

prevent to write multiple target attributes in one tag.
  • Loading branch information
albert-github committed Sep 28, 2017
1 parent 3aa86ce commit 97bfbfa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 5 additions & 2 deletions src/dot.cpp
Expand Up @@ -291,6 +291,7 @@ static QCString replaceRef(const QCString &buf,const QCString relPath,
//bool isXLink=FALSE;
int len = 6;
int indexS = buf.find("href=\""), indexE;
bool setTarget = FALSE;
if (indexS>5 && buf.find("xlink:href=\"")!=-1) // XLink href (for SVG)
{
indexS-=6;
Expand Down Expand Up @@ -331,7 +332,9 @@ static QCString replaceRef(const QCString &buf,const QCString relPath,
QCString url = link.mid(marker+1);
if (!ref.isEmpty())
{
result = externalLinkTarget() + externalRef(relPath,ref,FALSE);
result = externalLinkTarget();
if (result != "") setTarget = TRUE;
result += externalRef(relPath,ref,FALSE);
}
result+= href+"=\"";
result+=externalRef(relPath,ref,TRUE);
Expand All @@ -342,7 +345,7 @@ static QCString replaceRef(const QCString &buf,const QCString relPath,
result = href+"=\"" + link + "\"";
}
}
if (!target.isEmpty())
if (!target.isEmpty() && !setTarget)
{
result+=" target=\""+target+"\"";
}
Expand Down
16 changes: 11 additions & 5 deletions src/ftvhelp.cpp
Expand Up @@ -274,6 +274,7 @@ void FTVHelp::generateLink(FTextStream &t,FTVNode *n)
{
//printf("FTVHelp::generateLink(ref=%s,file=%s,anchor=%s\n",
// n->ref.data(),n->file.data(),n->anchor.data());
bool setTarget = FALSE;
if (n->file.isEmpty()) // no link
{
t << "<b>" << convertToHtml(n->name) << "</b>";
Expand All @@ -283,7 +284,9 @@ void FTVHelp::generateLink(FTextStream &t,FTVNode *n)
if (!n->ref.isEmpty()) // link to entity imported via tag file
{
t << "<a class=\"elRef\" ";
t << externalLinkTarget() << externalRef("",n->ref,FALSE);
QCString result = externalLinkTarget();
if (result != "") setTarget = TRUE;
t << result << externalRef("",n->ref,FALSE);
}
else // local link
{
Expand All @@ -292,10 +295,13 @@ void FTVHelp::generateLink(FTextStream &t,FTVNode *n)
t << "href=\"";
t << externalRef("",n->ref,TRUE);
t << node2URL(n);
if (m_topLevelIndex)
t << "\" target=\"basefrm\">";
else
t << "\" target=\"_self\">";
if (!setTarget)
{
if (m_topLevelIndex)
t << "\" target=\"basefrm\">";
else
t << "\" target=\"_self\">";
}
t << convertToHtml(n->name);
t << "</a>";
if (!n->ref.isEmpty())
Expand Down

1 comment on commit 97bfbfa

@sheavner
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be an extra branch case on line 304 for when setTarget is true. I'm missing a "> in my links via tagfiles to other projects and the html pages render with blank table rows.

Please sign in to comment.