summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2020-06-13 12:55:13 (GMT)
committerGitHub <noreply@github.com>2020-06-13 12:55:13 (GMT)
commite53fa89addc9659ad406298d27a6376d1eb53e0d (patch)
treeeaa7ea5f3aa70a61a2ec3343cd6dacf7dd601aa2
parente7637f9dd977e9821394e7bed4dec02aec41ab9e (diff)
downloadDoxygen-e53fa89addc9659ad406298d27a6376d1eb53e0d.zip
Doxygen-e53fa89addc9659ad406298d27a6376d1eb53e0d.tar.gz
Doxygen-e53fa89addc9659ad406298d27a6376d1eb53e0d.tar.bz2
Incorrect label in map of dot files in xhtml (#7840)
When a filename of a file starts with a digit the mapping of the resulting dot files results in message like: ``` Syntax of value for attribute id of map is not valid ``` an id cannot start with a digit, so an "a" is placed in front of it (unconditionally to overcome problems with a double label id i.e filename 087.cpp and a087.cpp).
-rw-r--r--src/dotfilepatcher.cpp2
-rw-r--r--src/dotgraph.cpp2
-rw-r--r--src/util.cpp10
-rw-r--r--src/util.h1
4 files changed, 13 insertions, 2 deletions
diff --git a/src/dotfilepatcher.cpp b/src/dotfilepatcher.cpp
index 20ce4c1..17f8cb7 100644
--- a/src/dotfilepatcher.cpp
+++ b/src/dotfilepatcher.cpp
@@ -460,7 +460,7 @@ bool DotFilePatcher::run() const
convertMapFile(tt,map->mapFile,map->relPath,map->urlOnly,map->context);
if (!result.isEmpty())
{
- t << "<map name=\"" << map->label << "\" id=\"" << map->label << "\">" << endl;
+ t << "<map name=\"" << map->label << "\" id=\"" << correctId(map->label) << "\">" << endl;
t << result;
t << "</map>" << endl;
}
diff --git a/src/dotgraph.cpp b/src/dotgraph.cpp
index c0cc4fd..1ad85e1 100644
--- a/src/dotgraph.cpp
+++ b/src/dotgraph.cpp
@@ -236,7 +236,7 @@ void DotGraph::generateCode(FTextStream &t)
else // add link to bitmap file with image map
{
if (!m_noDivTag) t << "<div class=\"center\">";
- t << "<img src=\"" << relImgName() << "\" border=\"0\" usemap=\"#" << getMapLabel() << "\" alt=\"" << getImgAltText() << "\"/>";
+ t << "<img src=\"" << relImgName() << "\" border=\"0\" usemap=\"#" << correctId(getMapLabel()) << "\" alt=\"" << getImgAltText() << "\"/>";
if (!m_noDivTag) t << "</div>";
t << endl;
if (m_regenerate || !insertMapFile(t, absMapName(), m_relPath, getMapLabel()))
diff --git a/src/util.cpp b/src/util.cpp
index 1624b1c..a298ace 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -5278,6 +5278,16 @@ QCString convertToId(const char *s)
return growBuf.get();
}
+/*! Some strings have been corrected but the requirement regarding the fact
+ * that an id cannot have a digit at the first position. To overcome problems
+ * with double labels we always place an "a" in front
+ */
+QCString correctId(QCString s)
+{
+ if (s.isEmpty()) return s;
+ return "a" + s;
+}
+
/*! Converts a string to an XML-encoded string */
QCString convertToXML(const char *s, bool keepEntities)
{
diff --git a/src/util.h b/src/util.h
index a93220c..65d164a 100644
--- a/src/util.h
+++ b/src/util.h
@@ -278,6 +278,7 @@ QCString insertTemplateSpecifierInScope(const QCString &scope,const QCString &te
QCString stripScope(const char *name);
QCString convertToId(const char *s);
+QCString correctId(QCString s);
QCString convertToHtml(const char *s,bool keepEntities=TRUE);