Permalink
Browse files

Bug 743367 - Duplicate attribute (target="_top" target="_top") genera…

…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 97bfbfa6c4d4eb07ac8c60545086c3370e9683b8
Showing with 16 additions and 7 deletions.
  1. +5 −2 src/dot.cpp
  2. +11 −5 src/ftvhelp.cpp
View
@@ -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;
@@ -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);
@@ -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+"\"";
}
View
@@ -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>";
@@ -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
{
@@ -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())

1 comment on commit 97bfbfa

@sheavner

This comment has been minimized.

sheavner commented on 97bfbfa Jan 10, 2018

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.