summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2018-04-22 10:01:39 (GMT)
committerGitHub <noreply@github.com>2018-04-22 10:01:39 (GMT)
commit68afe391f48ea23e02c15d096ed17c0f2a636987 (patch)
treecaf42cac4bb31d6c0b9a11726bfe6011110ca87e /src
parent0a6110b16aa32021f9a799b7370a047cb764b4f2 (diff)
parent66f9f6ec07f29fb737b0d0fe11072ea156581576 (diff)
downloadDoxygen-68afe391f48ea23e02c15d096ed17c0f2a636987.zip
Doxygen-68afe391f48ea23e02c15d096ed17c0f2a636987.tar.gz
Doxygen-68afe391f48ea23e02c15d096ed17c0f2a636987.tar.bz2
Merge pull request #696 from albert-github/feature/bug_xhtml_image_alt
XHTML image tag mandatory alt attribute
Diffstat (limited to 'src')
-rw-r--r--src/htmldocvisitor.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 8b6d26c..6a9c142 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -126,21 +126,29 @@ static bool mustBeOutsideParagraph(DocNode *n)
return FALSE;
}
-static QString htmlAttribsToString(const HtmlAttribList &attribs)
+static QString htmlAttribsToString(const HtmlAttribList &attribs, const bool img_tag = FALSE)
{
QString result;
HtmlAttribListIterator li(attribs);
HtmlAttrib *att;
+ bool alt_set = FALSE;
+
for (li.toFirst();(att=li.current());++li)
{
if (!att->value.isEmpty()) // ignore attribute without values as they
- // are not XHTML compliant
+ // are not XHTML compliant, with the exception
+ // of the alt attribute with the img tag
{
result+=" ";
result+=att->name;
result+="=\""+convertToXML(att->value)+"\"";
+ if (att->name == "alt") alt_set = TRUE;
}
}
+ if (!alt_set && img_tag)
+ {
+ result+=" alt=\"\"";
+ }
return result;
}
@@ -1521,7 +1529,7 @@ void HtmlDocVisitor::visitPre(DocImage *img)
else
{
m_t << "<img src=\"" << correctURL(url,img->relPath()) << "\""
- << sizeAttribs << htmlAttribsToString(img->attribs())
+ << sizeAttribs << htmlAttribsToString(img->attribs(), TRUE)
<< "/>" << endl;
}
}