Skip to content

Commit

Permalink
Merge pull request #7479 from albert-github/feature/issue_7477
Browse files Browse the repository at this point in the history
issue #7477 Broken urls in the xml output
  • Loading branch information
doxygen committed Jan 4, 2020
2 parents 0e874a5 + 2f79c69 commit d6ab8a1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
14 changes: 9 additions & 5 deletions src/xmldocvisitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -824,18 +824,22 @@ void XmlDocVisitor::visitPre(DocImage *img)
{
if (m_hide) return;

QCString baseName=img->name();
int i;
if ((i=baseName.findRev('/'))!=-1 || (i=baseName.findRev('\\'))!=-1)
QCString url = img->url();
QCString baseName;
if (url.isEmpty())
{
baseName=baseName.right(baseName.length()-i-1);
baseName = img->relPath()+img->name();
}
else
{
baseName = correctURL(url,img->relPath());
}
visitPreStart(m_t, "image", FALSE, this, img->children(), baseName, TRUE, img->type(), img->width(), img->height(), img ->isInlineImage());

// copy the image to the output dir
FileDef *fd;
bool ambig;
if ((fd=findFileDef(Doxygen::imageNameDict,img->name(),ambig)))
if (url.isEmpty() && (fd=findFileDef(Doxygen::imageNameDict,img->name(),ambig)))
{
QFile inImage(fd->absFilePath());
QFile outImage(Config_getString(XML_OUTPUT)+"/"+baseName.data());
Expand Down
28 changes: 14 additions & 14 deletions testing/031/indexpage.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@
<image type="docbook" name="sample.png"/>
More text.</para>
<para>SVG image with caption:<linebreak/>
<image type="html" name="license-MIT-brightgreen.svg">A caption</image>
<image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.svg">A caption</image>
</para>
<para>PNG image with caption:<linebreak/>
<image type="html" name="license-MIT-brightgreen.png">A caption</image>
<image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.png">A caption</image>
</para>
<para>SVG image without caption:<linebreak/>
<image type="html" name="license-MIT-brightgreen.svg"/>
<image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.svg"/>
</para>
<para>PNG image without caption:<linebreak/>
<image type="html" name="license-MIT-brightgreen.png"/>
<image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.png"/>
</para>
<para>Inline SVG image with caption:<linebreak/>
This image is inline <image type="html" name="license-MIT-brightgreen.svg" inline="yes">MIT license</image>
This image is inline <image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.svg" inline="yes">MIT license</image>
within the text.</para>
<para>Inline PNG image with caption:<linebreak/>
This image is inline <image type="html" name="license-MIT-brightgreen.png" inline="yes">MIT license</image>
This image is inline <image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.png" inline="yes">MIT license</image>
within the text.</para>
<para>Markdown style linked SVG image:<linebreak/>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="license-MIT-brightgreen.svg" inline="yes"/></ulink></para>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.svg" inline="yes"/></ulink></para>
<para>Markdown style linked PNG image:<linebreak/>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="license-MIT-brightgreen.png" inline="yes"/></ulink></para>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.png" inline="yes"/></ulink></para>
<para>HTML style linked SVG image:<linebreak/>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="license-MIT-brightgreen.svg" inline="yes"/></ulink></para>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.svg" inline="yes"/></ulink></para>
<para>HTML style linked PNG image:<linebreak/>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="license-MIT-brightgreen.png" inline="yes"/></ulink></para>
<ulink url="http://opensource.org/licenses/MIT"><image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.png" inline="yes"/></ulink></para>
<para>HTML style unlinked SVG image:<linebreak/>
<image type="html" name="license-MIT-brightgreen.svg" inline="yes"/>
<image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.svg" inline="yes"/>
</para>
<para>HTML style unlinked PNG image:<linebreak/>
<image type="html" name="license-MIT-brightgreen.png" inline="yes"/>
<image type="html" name="http://img.shields.io/badge/license-MIT-brightgreen.png" inline="yes"/>
</para>
<para>Some markdown image tests<linebreak/>
<image type="html" name="docs-Doxygen-blue.svg?foo&amp;bar" inline="yes"/>
<image type="html" name="https://img.shields.io/badge/docs-Doxygen-blue.svg?foo&amp;bar" inline="yes"/>
<ulink url="http://www.doxygen.nl?foo&amp;bar">Some normal link</ulink></para>
<para>
<image type="html" name="docs-Doxygen-blue.svg?foo&amp;bar" inline="yes"/>
<image type="html" name="https://img.shields.io/badge/docs-Doxygen-blue.svg?foo&amp;bar" inline="yes"/>
<ulink url="http://www.doxygen.nl?foo&amp;bar">Some normal link</ulink>
</para>
</detaileddescription>
Expand Down

0 comments on commit d6ab8a1

Please sign in to comment.