summaryrefslogtreecommitdiffstats
path: root/src/htmldocvisitor.cpp
diff options
context:
space:
mode:
authorDimitri van Heesch <doxygen@gmail.com>2018-12-02 17:40:28 (GMT)
committerDimitri van Heesch <doxygen@gmail.com>2018-12-02 17:40:28 (GMT)
commitd33a129d784f2b0f823f14a008e929513b302ad3 (patch)
tree2236060a70d4e72362a2e1bdc6fb84e89285afcd /src/htmldocvisitor.cpp
parenta9e47f4c58c79d4af1b8e319bd1a56277bdfee8a (diff)
downloadDoxygen-d33a129d784f2b0f823f14a008e929513b302ad3.zip
Doxygen-d33a129d784f2b0f823f14a008e929513b302ad3.tar.gz
Doxygen-d33a129d784f2b0f823f14a008e929513b302ad3.tar.bz2
Fixed incorrect XHTML output for test 021
Diffstat (limited to 'src/htmldocvisitor.cpp')
-rw-r--r--src/htmldocvisitor.cpp83
1 files changed, 55 insertions, 28 deletions
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index dfa6089..2223ed9 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -134,6 +134,7 @@ static bool mustBeOutsideParagraph(DocNode *n)
case DocNode::Kind_HtmlBlockQuote:
/* \parblock */
case DocNode::Kind_ParBlock:
+ case DocNode::Kind_IncOperator:
return TRUE;
case DocNode::Kind_Verbatim:
{
@@ -152,6 +153,57 @@ static bool mustBeOutsideParagraph(DocNode *n)
return FALSE;
}
+static bool isDocVerbatimVisible(DocVerbatim *s)
+{
+ switch(s->type())
+ {
+ case DocVerbatim::ManOnly:
+ case DocVerbatim::LatexOnly:
+ case DocVerbatim::XmlOnly:
+ case DocVerbatim::RtfOnly:
+ case DocVerbatim::DocbookOnly:
+ return FALSE;
+ default:
+ return TRUE;
+ }
+}
+
+static bool isDocIncludeVisible(DocInclude *s)
+{
+ switch (s->type())
+ {
+ case DocInclude::DontInclude:
+ return FALSE;
+ default:
+ return TRUE;
+ }
+}
+
+static bool isDocIncOperatorVisible(DocIncOperator *s)
+{
+ switch (s->type())
+ {
+ case DocIncOperator::Skip:
+ return FALSE;
+ default:
+ return TRUE;
+ }
+}
+
+static bool isInvisibleNode(DocNode *node)
+{
+ return (node->kind()==DocNode::Kind_WhiteSpace)
+ || // skip over image nodes that are not for HTML output
+ (node->kind()==DocNode::Kind_Image && ((DocImage*)node)->type()!=DocImage::Html)
+ || // skip over verbatim nodes that are not visible in the HTML output
+ (node->kind()==DocNode::Kind_Verbatim && !isDocVerbatimVisible((DocVerbatim*)node))
+ || // skip over include nodes that are not visible in the HTML output
+ (node->kind()==DocNode::Kind_Include && !isDocIncludeVisible((DocInclude*)node))
+ || // skip over include operator nodes that are not visible in the HTML output
+ (node->kind()==DocNode::Kind_IncOperator && !isDocIncOperatorVisible((DocIncOperator*)node))
+ ;
+}
+
static QString htmlAttribsToString(const HtmlAttribList &attribs, bool img_tag = FALSE)
{
QString result;
@@ -679,7 +731,7 @@ void HtmlDocVisitor::visit(DocIncOperator *op)
// op->type(),op->isFirst(),op->isLast(),op->text().data());
if (op->isFirst())
{
- forceStartParagraph(op);
+ forceEndParagraph(op);
if (!m_hide) m_t << PREFRAG_START;
pushEnabled();
m_hide=TRUE;
@@ -1108,8 +1160,7 @@ void HtmlDocVisitor::visitPre(DocPara *p)
uint nodeIndex = 0;
if (p && nodeIndex<p->children().count())
{
- while (nodeIndex<p->children().count() &&
- p->children().at(nodeIndex)->kind()==DocNode::Kind_WhiteSpace)
+ while (nodeIndex<p->children().count() && isInvisibleNode(p->children().at(nodeIndex)))
{
nodeIndex++;
}
@@ -1177,7 +1228,7 @@ void HtmlDocVisitor::visitPost(DocPara *p)
int nodeIndex = p->children().count()-1;
if (nodeIndex>=0)
{
- while (nodeIndex>=0 && p->children().at(nodeIndex)->kind()==DocNode::Kind_WhiteSpace)
+ while (nodeIndex>=0 && isInvisibleNode(p->children().at(nodeIndex)))
{
nodeIndex--;
}
@@ -2277,30 +2328,6 @@ static bool insideStyleChangeThatIsOutsideParagraph(DocPara *para,int nodeIndex)
return styleOutsideParagraph;
}
-static bool isDocVerbatimVisible(DocVerbatim *s)
-{
- switch(s->type())
- {
- case DocVerbatim::ManOnly:
- case DocVerbatim::LatexOnly:
- case DocVerbatim::XmlOnly:
- case DocVerbatim::RtfOnly:
- case DocVerbatim::DocbookOnly:
- return FALSE;
- default:
- return TRUE;
- }
-}
-
-static bool isInvisibleNode(DocNode *node)
-{
- return (node->kind()==DocNode::Kind_WhiteSpace) ||
- // skip over image nodes that are not for HTML output
- (node->kind()==DocNode::Kind_Image && ((DocImage*)node)->type()!=DocImage::Html) ||
- // skip over verbatim nodes that are not visible in the HTML output
- (node->kind()==DocNode::Kind_Verbatim && !isDocVerbatimVisible((DocVerbatim*)node));
-}
-
/** Used for items found inside a paragraph, which due to XHTML restrictions
* have to be outside of the paragraph. This method will forcefully end
* the current paragraph and forceStartParagraph() will restart it.