diff options
author | albert-github <albert.tests@gmail.com> | 2019-08-12 13:10:13 (GMT) |
---|---|---|
committer | albert-github <albert.tests@gmail.com> | 2019-08-12 13:10:13 (GMT) |
commit | e427e3b1e2a03af6d87b7d46996aabafde454bcc (patch) | |
tree | 95bab2ff29a3795b4f7c926b79604749a1d5afc7 | |
parent | 3e8fe63473b047bf3d48c734750334244e9981a8 (diff) | |
download | Doxygen-e427e3b1e2a03af6d87b7d46996aabafde454bcc.zip Doxygen-e427e3b1e2a03af6d87b7d46996aabafde454bcc.tar.gz Doxygen-e427e3b1e2a03af6d87b7d46996aabafde454bcc.tar.bz2 |
Opening and ending tag mismatch: tbody in docbook output
In case of docbook output and having nesting tables (e.g. in the tables chapter of the doxygen documentation), we get invalid xml for docbook as the `<tbody>` is not closed.
Each table level should have an own flag to signal whether or not the `<tbiody>` tag is set or not, otherwise the inner table resets the outer tables its "flag".
-rw-r--r-- | src/docbookvisitor.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index ce3a845..47c0121 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -962,12 +962,19 @@ DB_VIS_C m_t << "</listitem></varlistentry>\n"; } +static int tabLevel = -1; static int colCnt = 0; -static bool bodySet = FALSE; // it is possible to have tables without a header +static bool *bodySet = NULL; // it is possible to have tables without a header, needs to be an array as we can have tables in tables void DocbookDocVisitor::visitPre(DocHtmlTable *t) { DB_VIS_C - bodySet = FALSE; + static int sizeBodySet = 0; + if (sizeBodySet <= ++tabLevel) + { + sizeBodySet += 10; + bodySet = (bool *)realloc((void *)bodySet,sizeBodySet); + } + bodySet[tabLevel] = FALSE; if (m_hide) return; m_t << "<informaltable frame=\"all\">" << endl; m_t << " <tgroup cols=\"" << t->numColumns() << "\" align=\"left\" colsep=\"1\" rowsep=\"1\">" << endl; @@ -982,8 +989,8 @@ void DocbookDocVisitor::visitPost(DocHtmlTable *) { DB_VIS_C if (m_hide) return; - if (bodySet) m_t << " </tbody>" << endl; - bodySet = FALSE; + if (bodySet[tabLevel--]) m_t << " </tbody>" << endl; + //bodySet = FALSE; m_t << " </tgroup>" << endl; m_t << "</informaltable>" << endl; } @@ -994,10 +1001,15 @@ DB_VIS_C colCnt = 0; if (m_hide) return; - if (tr->isHeading()) m_t << "<thead>\n"; - else if (!bodySet) + if (tr->isHeading()) + { + if (bodySet[tabLevel]) m_t << "</tbody>\n"; + bodySet[tabLevel] = FALSE; + m_t << "<thead>\n"; + } + else if (!bodySet[tabLevel]) { - bodySet = TRUE; + bodySet[tabLevel] = TRUE; m_t << "<tbody>\n"; } @@ -1038,7 +1050,7 @@ DB_VIS_C m_t << "</row>\n"; if (tr->isHeading()) { - bodySet = TRUE; + bodySet[tabLevel] = TRUE; m_t << "</thead><tbody>\n"; } } |