From a53d5b44731b55197d7ff2ae046552374d011e59 Mon Sep 17 00:00:00 2001 From: albert-github Date: Sun, 6 Jan 2019 12:31:51 +0100 Subject: issue #6744 Ampersand in Markdown image URL is not escaped in XML output Convert name / url based on HTML / XML conventions and don't do double conversions (XML). --- src/htmldocvisitor.cpp | 4 +- src/util.cpp | 27 ++++++++++++- src/util.h | 2 +- src/xmldocvisitor.cpp | 6 +-- testing/031/indexpage.xml | 101 +++++++++++++++++++++++++--------------------- testing/031_image.dox | 8 +++- 6 files changed, 91 insertions(+), 57 deletions(-) mode change 100644 => 100755 testing/031/indexpage.xml diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp index 8c78f85..9f9e653 100644 --- a/src/htmldocvisitor.cpp +++ b/src/htmldocvisitor.cpp @@ -1584,7 +1584,7 @@ void HtmlDocVisitor::visitPre(DocHRef *href) else { QCString url = correctURL(href->url(),href->relPath()); - m_t << "attribs()) << ">"; } } @@ -1668,7 +1668,7 @@ void HtmlDocVisitor::visitPre(DocImage *img) } else { - m_t << "\""': growBuf.addStr(">"); break; - case '&': growBuf.addStr("&"); break; + case '&': if (keepEntities) + { + const char *e=p; + char ce; + while ((ce=*e++)) + { + if (ce==';' || (!(isId(ce) || ce=='#'))) break; + } + if (ce==';') // found end of an entity + { + // copy entry verbatim + growBuf.addChar(c); + while (purl()); - m_t << "\">"; + m_t << "url(), TRUE) << "\">"; } void XmlDocVisitor::visitPost(DocHRef *) diff --git a/testing/031/indexpage.xml b/testing/031/indexpage.xml old mode 100644 new mode 100755 index b6a7ed0..7e368f3 --- a/testing/031/indexpage.xml +++ b/testing/031/indexpage.xml @@ -1,47 +1,54 @@ - - - - index - My Project - - - - Some text. - Doxygen logo - - More text. - SVG image with caption: -A caption - - PNG image with caption: -A caption - - SVG image without caption: - - - PNG image without caption: - - - Inline SVG image with caption: -This image is inline MIT license - within the text. - Inline PNG image with caption: -This image is inline MIT license - within the text. - Markdown style linked SVG image: - - Markdown style linked PNG image: - - HTML style linked SVG image: - - HTML style linked PNG image: - - HTML style unlinked SVG image: - - - HTML style unlined PNG image: - - - - - + + + + index + My Project + + + + Some text. + Doxygen logo + + More text. + SVG image with caption: +A caption + + PNG image with caption: +A caption + + SVG image without caption: + + + PNG image without caption: + + + Inline SVG image with caption: +This image is inline MIT license + within the text. + Inline PNG image with caption: +This image is inline MIT license + within the text. + Markdown style linked SVG image: + + Markdown style linked PNG image: + + HTML style linked SVG image: + + HTML style linked PNG image: + + HTML style unlinked SVG image: + + + HTML style unlinked PNG image: + + + Some markdown image tests + + Some normal link + + + Some normal link + + + + diff --git a/testing/031_image.dox b/testing/031_image.dox index 61f5bba..e451592 100644 --- a/testing/031_image.dox +++ b/testing/031_image.dox @@ -47,7 +47,13 @@ HTML style linked PNG image:\n HTML style unlinked SVG image:\n MIT license -HTML style unlined PNG image:\n +HTML style unlinked PNG image:\n MIT license +Some markdown image tests\n +![Some SVG image](https://img.shields.io/badge/docs-Doxygen-blue.svg?foo&bar) +[Some normal link](http://www.doxygen.nl?foo&bar) + +![Some SVG image](https://img.shields.io/badge/docs-Doxygen-blue.svg?foo&bar) +[Some normal link](http://www.doxygen.nl?foo&bar) */ -- cgit v0.12