From c37fe44163a254835aef8cf05e59979b18552ab0 Mon Sep 17 00:00:00 2001 From: Jan Theegarten Date: Thu, 18 Jun 2020 15:39:54 +0200 Subject: Implement alt="" for images in xml. --- src/xmldocvisitor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp index 73aac7c..77f3e8e 100644 --- a/src/xmldocvisitor.cpp +++ b/src/xmldocvisitor.cpp @@ -41,7 +41,7 @@ static void visitCaption(XmlDocVisitor *parent, QList children) static void visitPreStart(FTextStream &t, const char *cmd, bool doCaption, XmlDocVisitor *parent, QList children, const QCString &name, bool writeType, DocImage::Type type, const QCString &width, - const QCString &height, bool inlineImage = FALSE) + const QCString &height, const QCString &alt = QCString(""), bool inlineImage = FALSE) { t << "<" << cmd; if (writeType) @@ -68,6 +68,10 @@ static void visitPreStart(FTextStream &t, const char *cmd, bool doCaption, { t << " height=\"" << convertToXML(height) << "\""; } + if (!alt.isEmpty()) + { + t << " alt=\"" << convertToXML(alt) << "\""; + } if (inlineImage) { t << " inline=\"yes\""; @@ -907,7 +911,7 @@ void XmlDocVisitor::visitPre(DocImage *img) { baseName = correctURL(url,img->relPath()); } - visitPreStart(m_t, "image", FALSE, this, img->children(), baseName, TRUE, img->type(), img->width(), img->height(), img ->isInlineImage()); + visitPreStart(m_t, "image", FALSE, this, img->children(), baseName, TRUE, img->type(), img->width(), img->height(), img->attribs().find("alt"), img->isInlineImage()); // copy the image to the output dir FileDef *fd; -- cgit v0.12