Skip to content

Commit

Permalink
issue #7672 Request: use <img> tags instead of <object> tags for SVG …
Browse files Browse the repository at this point in the history
…images

In case of svg and inline images we have to follow a little bit another strategy.
In markdown we also have to declare all markdown images to inline images (which is also consistent with the handling on github)
  • Loading branch information
albert-github committed Mar 29, 2020
1 parent e688cb8 commit 2d91d8c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
22 changes: 3 additions & 19 deletions src/htmldocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1750,7 +1750,7 @@ void HtmlDocVisitor::visitPre(DocImage *img)
{
src = correctURL(url,img->relPath());
}
if (typeSVG)
if (typeSVG && !inlineImage)
{
m_t << "<object type=\"image/svg+xml\" data=\"" << convertToHtml(src)
<< "\"" << sizeAttribs << attrs;
Expand Down Expand Up @@ -1789,14 +1789,7 @@ void HtmlDocVisitor::visitPre(DocImage *img)
}
else if (inlineImage)
{
if (typeSVG)
{
m_t << ">" << alt << "</object>";
}
else
{
m_t << "/>";
}
m_t << "/>";
}
}
else // other format -> skip
Expand All @@ -1816,16 +1809,7 @@ void HtmlDocVisitor::visitPost(DocImage *img)
{
if (inlineImage)
{
if (img->isSVG())
{
QCString alt;
QCString attrs = htmlAttribsToString(img->attribs(),&alt);
m_t << "\">" << alt << "</object>";
}
else
{
m_t << "\"/>";
}
m_t << "\"/>";
}
else // end <div class="caption">
{
Expand Down
2 changes: 1 addition & 1 deletion src/markdown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)

static void writeMarkdownImage(GrowBuf &out, const char *fmt, bool explicitTitle, QCString title, QCString content, QCString link, FileDef *fd)
{
out.addStr("@image ");
out.addStr("@image{inline} ");
out.addStr(fmt);
out.addStr(" ");
out.addStr(link.mid(fd ? 0 : 5));
Expand Down

0 comments on commit 2d91d8c

Please sign in to comment.