summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2018-04-09 12:12:03 (GMT)
committeralbert-github <albert.tests@gmail.com>2018-04-09 12:12:03 (GMT)
commit66f9f6ec07f29fb737b0d0fe11072ea156581576 (patch)
treec3248ff7d7932a90c179e03caa775c272e8d2c98 /src
parent7e2fcd305c8c9377aa958a3d812cc31bc81c0e32 (diff)
downloadDoxygen-66f9f6ec07f29fb737b0d0fe11072ea156581576.zip
Doxygen-66f9f6ec07f29fb737b0d0fe11072ea156581576.tar.gz
Doxygen-66f9f6ec07f29fb737b0d0fe11072ea156581576.tar.bz2
XHTML image tag mandatory alt attribute
The alt attribute is mandatory for the image tag, it is possible to have it written out with an empty string. In case with the image tag there is no alt attribute the empty string alt attribute is added.
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;
}
}