diff options
author | Dimitri van Heesch <doxygen@gmail.com> | 2020-02-02 12:56:57 (GMT) |
---|---|---|
committer | Dimitri van Heesch <doxygen@gmail.com> | 2020-02-02 13:01:40 (GMT) |
commit | 90fb3132ce02eb44abe3797954267fefcb8d10a8 (patch) | |
tree | 82488a1c3d2465d3c50d3aa9c65f7652a585797e /src/docbookvisitor.cpp | |
parent | a2954444b3b2bd0af09f3c886f13b4597866153a (diff) | |
download | Doxygen-90fb3132ce02eb44abe3797954267fefcb8d10a8.zip Doxygen-90fb3132ce02eb44abe3797954267fefcb8d10a8.tar.gz Doxygen-90fb3132ce02eb44abe3797954267fefcb8d10a8.tar.bz2 |
Avoid unsupported html attributes from appearing in the XML/docbook output and other small fixes
Diffstat (limited to 'src/docbookvisitor.cpp')
-rw-r--r-- | src/docbookvisitor.cpp | 97 |
1 files changed, 37 insertions, 60 deletions
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp index 8bb5a34..4b4de4a 100644 --- a/src/docbookvisitor.cpp +++ b/src/docbookvisitor.cpp @@ -69,6 +69,21 @@ static QCString filterId(const char *s) return growBuf.get(); } +static bool supportedHtmlAttribute(const QCString &name) +{ + return (name=="align" || + name=="bgcolor" || + name=="border" || + name=="cellpadding" || + name=="cellspacing" || + name=="class" || + name=="frame" || + name=="label" || + name=="tabstyle" || + name=="title"); +} + + void DocbookDocVisitor::visitCaption(const QList<DocNode> &children) { QListIterator<DocNode> cli(children); @@ -1034,25 +1049,10 @@ DB_VIS_C HtmlAttrib *opt; for (li.toFirst();(opt=li.current());++li) { - if (opt->name=="class") - { - // just skip it - } - else if (opt->name=="style") - { - // just skip it - } - else if (opt->name=="height") - { - // just skip it - } - else if (opt->name=="filter") + if (supportedHtmlAttribute(opt->name)) { - // just skip it - } - else - { - m_t << " " << opt->name << "='" << opt->value << "'"; + // process supported attributes only + m_t << " " << opt->name << "='" << convertToDocBook(opt->value) << "'"; } } m_t << ">\n"; @@ -1095,54 +1095,31 @@ DB_VIS_C } else if (opt->name=="class") { - if (opt->value == "markdownTableBodyRight") + if (opt->value.left(13)=="markdownTable") // handle markdown generated attributes { - m_t << " align='right'"; - } - else if (opt->value == "markdownTableBodyLeftt") - { - m_t << " align='left'"; - } - else if (opt->value == "markdownTableBodyCenter") - { - m_t << " align='center'"; - } - else if (opt->value == "markdownTableHeadRight") - { - m_t << " align='right'"; - } - else if (opt->value == "markdownTableHeadLeftt") - { - m_t << " align='left'"; - } - else if (opt->value == "markdownTableHeadCenter") - { - m_t << " align='center'"; + if (opt->value.right(5)=="Right") + { + m_t << " align='right'"; + } + else if (opt->value.right(4)=="Left") + { + m_t << " align='left'"; + } + else if (opt->value.right(6)=="Center") + { + m_t << " align='center'"; + } + // skip 'markdownTable*' value ending with "None" } - else if (!opt->value.isEmpty()) + else { - m_t << " " << opt->name << "='" << opt->value << "'"; + m_t << " class='" << convertToDocBook(opt->value) << "'"; } } - else if (opt->name=="style") - { - // just skip it - } - else if (opt->name=="width") - { - // just skip it - } - else if (opt->name=="height") - { - // just skip it - } - else if (opt->name=="nowrap" && opt->value.isEmpty()) - { - m_t << " " << opt->name << "='nowrap'"; - } - else + else if (supportedHtmlAttribute(opt->name)) { - m_t << " " << opt->name << "='" << opt->value << "'"; + // process supported attributes only + m_t << " " << opt->name << "='" << convertToDocBook(opt->value) << "'"; } } m_t << ">"; |