summaryrefslogtreecommitdiffstats
path: root/src/htmlgen.cpp
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2019-06-17 12:23:28 (GMT)
committeralbert-github <albert.tests@gmail.com>2019-06-17 12:23:28 (GMT)
commitb81d5b4c799e1180f5570ab8c8626ff46f3aa84a (patch)
tree4b0655d531ae170734f0481c5b1d506758b73b55 /src/htmlgen.cpp
parent4628578fe856f3ccfe3ade8f702671bfa1854566 (diff)
downloadDoxygen-b81d5b4c799e1180f5570ab8c8626ff46f3aa84a.zip
Doxygen-b81d5b4c799e1180f5570ab8c8626ff46f3aa84a.tar.gz
Doxygen-b81d5b4c799e1180f5570ab8c8626ff46f3aa84a.tar.bz2
Incorrect (X)HTML code when generating source code.
When having the example: ``` /*! \file * \brief * Prerequisite header file */ //! \cond #ifdef HAVE_CONFIG_H #include "gmxpre-config.h" #endif //! \endcond ``` and we run xmllint on it: ``` xmllint --path .../testing/dtd --noout --nonet --postvalid html/*.html ``` we get the messages: ``` html/aa_8h_source.html:75: parser error : Opening and ending tag mismatch: div line 67 and body </body> ^ html/aa_8h_source.html:76: parser error : Opening and ending tag mismatch: body line 17 and html </html> ^ html/aa_8h_source.html:77: parser error : Premature end of data in tag html line 2 ^ ``` It looks like the problematic part in this case is the doxygen type comment at the end of the file. In the past similar situations were present in LaTeX (related to maximum line length correction), but it was only fixed for LaTeX. Besides the change for HTML also small changes were necessary for RTF and docbook.
Diffstat (limited to 'src/htmlgen.cpp')
-rw-r--r--src/htmlgen.cpp35
1 files changed, 31 insertions, 4 deletions
diff --git a/src/htmlgen.cpp b/src/htmlgen.cpp
index d25dafc..b3abd09 100644
--- a/src/htmlgen.cpp
+++ b/src/htmlgen.cpp
@@ -57,6 +57,7 @@ static QCString g_header;
static QCString g_footer;
static QCString g_mathjax_code;
+static bool DoxyCodeLineOpen = FALSE;
// note: this is only active if DISABLE_INDEX=YES, if DISABLE_INDEX is disabled, this
// part will be rendered inside menu.js
@@ -530,7 +531,12 @@ void HtmlCodeGenerator::writeLineNumber(const char *ref,const char *filename,
qsnprintf(lineNumber,maxLineNrStr,"%5d",l);
qsnprintf(lineAnchor,maxLineNrStr,"l%05d",l);
- m_t << "<div class=\"line\">";
+ if (!DoxyCodeLineOpen)
+ {
+ m_t << "<div class=\"line\">";
+ DoxyCodeLineOpen = TRUE;
+ }
+
m_t << "<a name=\"" << lineAnchor << "\"></a><span class=\"lineno\">";
if (filename)
{
@@ -661,12 +667,16 @@ void HtmlCodeGenerator::writeTooltip(const char *id, const DocLinkInfo &docInfo,
}
-void HtmlCodeGenerator::startCodeLine(bool hasLineNumbers)
+void HtmlCodeGenerator::startCodeLine(bool)
{
if (m_streamSet)
{
- if (!hasLineNumbers) m_t << "<div class=\"line\">";
m_col=0;
+ if (!DoxyCodeLineOpen)
+ {
+ m_t << "<div class=\"line\">";
+ DoxyCodeLineOpen = TRUE;
+ }
}
}
@@ -679,7 +689,11 @@ void HtmlCodeGenerator::endCodeLine()
m_t << " ";
m_col++;
}
- m_t << "</div>";
+ if (DoxyCodeLineOpen)
+ {
+ m_t << "</div>\n";
+ DoxyCodeLineOpen = FALSE;
+ }
}
}
@@ -2640,6 +2654,19 @@ void HtmlGenerator::endConstraintList()
t << "</div>" << endl;
}
+void HtmlGenerator::startCodeFragment()
+{
+ t << PREFRAG_START;
+}
+
+void HtmlGenerator::endCodeFragment()
+{
+ //endCodeLine checks is there is still an open code line, if so closes it.
+ endCodeLine();
+
+ t << PREFRAG_END;
+}
+
void HtmlGenerator::lineBreak(const char *style)
{
if (style)