From 61caf5d22fc908fa39ea2eff460720e545b0637f Mon Sep 17 00:00:00 2001
From: Dimitri van Heesch
Date: Thu, 27 Oct 2022 20:11:43 +0200
Subject: [PATCH] Improve handling of and tags
---
src/commentscan.l | 28 +++-------
src/docbookvisitor.cpp | 15 ++++-
src/docbookvisitor.h | 1 +
src/docnode.cpp | 55 ++++++++++++++++---
src/docnode.h | 27 ++++++++-
src/docparser.cpp | 4 ++
src/htmldocvisitor.cpp | 20 +++++--
src/htmldocvisitor.h | 1 +
src/latexdocvisitor.cpp | 25 ++++++++-
src/latexdocvisitor.h | 1 +
src/mandocvisitor.cpp | 24 ++++++--
src/mandocvisitor.h | 1 +
src/perlmodgen.cpp | 19 +++++--
src/printdocvisitor.h | 30 ++++++----
src/rtfdocvisitor.cpp | 34 +++++++-----
src/rtfdocvisitor.h | 1 +
src/textdocvisitor.h | 1 +
src/xmldocvisitor.cpp | 16 +++++-
src/xmldocvisitor.h | 1 +
templates/latex/header.tex | 1 +
testing/060/class_details_c_s_style.xml | 15 +++++
testing/060/class_details_nested.xml | 14 +++++
.../060/class_details_summary_at_bottom.xml | 14 +++++
testing/060/class_details_summary_at_top.xml | 14 +++++
testing/060/class_details_without_summary.xml | 14 +++++
testing/060_details.cpp | 53 ++++++++++++++++++
26 files changed, 351 insertions(+), 78 deletions(-)
create mode 100644 testing/060/class_details_c_s_style.xml
create mode 100644 testing/060/class_details_nested.xml
create mode 100644 testing/060/class_details_summary_at_bottom.xml
create mode 100644 testing/060/class_details_summary_at_top.xml
create mode 100644 testing/060/class_details_without_summary.xml
create mode 100644 testing/060_details.cpp
diff --git a/src/commentscan.l b/src/commentscan.l
index afb7eb4dd..9837e8df2 100644
--- a/src/commentscan.l
+++ b/src/commentscan.l
@@ -712,20 +712,9 @@ STopt [^\n@\\]*
{
setOutput(yyscanner,OutputBrief);
}
- else
+ else // HTML5 style as part of section.
{
- int id = yyextra->HTMLDetailsSummary.back();
- if (id == 0)
- {
- addOutput(yyscanner,"\\htmlonly
\\endhtmlonly");
- addOutput(yyscanner,yytext);
- }
- else
- {
- addOutput(yyscanner,"");
- }
- yyextra->HTMLDetailsSummary.pop_back();
- yyextra->HTMLDetailsSummary.push_back(id+1);
+ addOutput(yyscanner,yytext);
}
}
"<"{REMARKS}">" { // start of a .NET XML style detailed description
@@ -735,15 +724,12 @@ STopt [^\n@\\]*
""{SUMMARY}">" { // start of a .NET XML style detailed description
if (!yyextra->HTMLDetailsSummary.empty())
{
- int id = yyextra->HTMLDetailsSummary.back();
- if (id == 1)
- {
- addOutput(yyscanner,yytext);
- addOutput(yyscanner,"\\htmlonly \\endhtmlonly");
- }
- else addOutput(yyscanner,"
");
+ addOutput(yyscanner,yytext);
+ }
+ else
+ {
+ setOutput(yyscanner,OutputDoc);
}
- else setOutput(yyscanner,OutputDoc);
}
""{REMARKS}">" { // end of a brief or detailed description
setOutput(yyscanner,OutputDoc);
diff --git a/src/docbookvisitor.cpp b/src/docbookvisitor.cpp
index 27d5bef0a..cf52c9459 100644
--- a/src/docbookvisitor.cpp
+++ b/src/docbookvisitor.cpp
@@ -306,7 +306,6 @@ DB_VIS_C
case DocStyleChange::Ins: break;
case DocStyleChange::Div: /* HTML only */ break;
case DocStyleChange::Span: /* HTML only */ break;
- case DocStyleChange::Summary: /* emulation of the tag inside a tag */
if (s.enable()) m_t << ""; else m_t << "";
break;
}
@@ -1172,11 +1171,25 @@ DB_VIS_C
m_t << "";
}
+void DocbookDocVisitor::operator()(const DocHtmlSummary &s)
+{
+DB_VIS_C
+ if (m_hide) return;
+ m_t << "";
+ visitChildren(s);
+ m_t << "";
+}
+
void DocbookDocVisitor::operator()(const DocHtmlDetails &d)
{
DB_VIS_C
if (m_hide) return;
m_t << "\n";
+ auto summary = d.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ }
m_t << "";
visitChildren(d);
m_t << "";
diff --git a/src/docbookvisitor.h b/src/docbookvisitor.h
index 15533ffa7..e5a0ab3cf 100644
--- a/src/docbookvisitor.h
+++ b/src/docbookvisitor.h
@@ -86,6 +86,7 @@ class DocbookDocVisitor : public DocVisitor
void operator()(const DocHtmlCaption &);
void operator()(const DocInternal &);
void operator()(const DocHRef &);
+ void operator()(const DocHtmlSummary &);
void operator()(const DocHtmlDetails &);
void operator()(const DocHtmlHeader &);
void operator()(const DocImage &);
diff --git a/src/docnode.cpp b/src/docnode.cpp
index 538ac7a34..6b699048e 100644
--- a/src/docnode.cpp
+++ b/src/docnode.cpp
@@ -137,7 +137,6 @@ const char *DocStyleChange::styleString() const
case DocStyleChange::Del: return "del";
case DocStyleChange::Underline: return "u";
case DocStyleChange::Ins: return "ins";
- case DocStyleChange::Summary: return "summary";
}
return "";
}
@@ -1286,9 +1285,36 @@ endheader:
}
//---------------------------------------------------------------------------
+void DocHtmlSummary::parse(DocNodeVariant *thisVariant)
+{
+ DBG(("DocHtmlSummary::parse() start\n"));
+ auto ns = AutoNodeStack(parser(),thisVariant);
+ parser()->tokenizer.setStateTitle();
+ int tok;
+ while ((tok=parser()->tokenizer.lex()))
+ {
+ int tagId;
+ // check of
+ if (tok==TK_HTMLTAG &&
+ (tagId=Mappers::htmlTagMapper->map(parser()->context.token->name)) && tagId==XML_SUMMARY &&
+ parser()->context.token->endTag
+ )
+ {
+ break;
+ }
+ else if (!parser()->defaultHandleToken(thisVariant,tok,children()))
+ {
+ parser()->errorHandleDefaultToken(thisVariant,tok,children(),"summary section");
+ }
+ }
+ parser()->tokenizer.setStatePara();
+}
+
+//---------------------------------------------------------------------------
+
int DocHtmlDetails::parse(DocNodeVariant *thisVariant)
{
- DBG(("DocHtmlHtmlDetails::parse() start\n"));
+ DBG(("DocHtmlDetails::parse() start\n"));
int retval=0;
auto ns = AutoNodeStack(parser(),thisVariant);
@@ -1305,10 +1331,21 @@ int DocHtmlDetails::parse(DocNodeVariant *thisVariant)
while (retval==TK_NEWPARA);
if (par) par->markLast();
- DBG(("DocHtmlHtmlDetails::parse() end retval=%s\n",DocTokenizer::retvalToString(retval)));
+ DBG(("DocHtmlDetails::parse() end retval=%s\n",DocTokenizer::retvalToString(retval)));
return (retval==RetVal_EndHtmlDetails) ? RetVal_OK : retval;
}
+void DocHtmlDetails::parseSummary(DocNodeVariant *thisVariant,HtmlAttribList &attribs)
+{
+ DBG(("DocHtmlDetails::parseSummary() start\n"));
+ m_summary = std::make_unique(DocHtmlSummary(parser(),thisVariant,attribs));
+ DocHtmlSummary *summary = &std::get(*m_summary);
+ summary->parse(m_summary.get());
+ DBG(("DocHtmlDetails::parseSummary() end\n"));
+}
+
+//---------------------------------------------------------------------------
+
int DocHRef::parse(DocNodeVariant *thisVariant)
{
int retval=RetVal_OK;
@@ -4577,7 +4614,13 @@ int DocPara::handleHtmlStartTag(DocNodeVariant *thisVariant,const QCString &tagN
{
if (!parser()->context.token->emptyTag)
{
- parser()->handleStyleEnter(thisVariant,children(),DocStyleChange::Summary,tagName,&parser()->context.token->attribs);
+ DocNodeVariant *n=parent();
+ while (n && !std::holds_alternative(*n)) n=::parent(n);
+ DocHtmlDetails *d = std::get_if(n);
+ if (d)
+ {
+ d->parseSummary(n,parser()->context.token->attribs);
+ }
}
}
break;
@@ -4968,10 +5011,6 @@ int DocPara::handleHtmlEndTag(DocNodeVariant *thisVariant,const QCString &tagNam
//children().push_back(std::make_unique(this,parser()->context.nodeStack.size(),DocStyleChange::Bold,FALSE));
break;
case XML_SUMMARY:
- if (insideDetails(thisVariant))
- {
- parser()->handleStyleLeave(thisVariant,children(),DocStyleChange::Summary,tagName);
- }
break;
case XML_REMARKS:
case XML_PARA:
diff --git a/src/docnode.h b/src/docnode.h
index b280ed8c7..b9728ff5c 100644
--- a/src/docnode.h
+++ b/src/docnode.h
@@ -46,7 +46,7 @@ class DocParser;
/* 40 */ DN(DocSimpleSect) DN_SEP DN(DocSimpleSectSep) DN_SEP DN(DocParamSect) DN_SEP DN(DocPara) DN_SEP DN(DocParamList) DN_SEP \
/* 45 */ DN(DocSimpleListItem) DN_SEP DN(DocHtmlListItem) DN_SEP DN(DocHtmlDescData) DN_SEP DN(DocHtmlCell) DN_SEP DN(DocHtmlCaption) DN_SEP \
/* 50 */ DN(DocHtmlRow) DN_SEP DN(DocHtmlTable) DN_SEP DN(DocHtmlBlockQuote) DN_SEP DN(DocText) DN_SEP DN(DocRoot) DN_SEP \
-/* 55 */ DN(DocHtmlDetails) \
+/* 55 */ DN(DocHtmlDetails) DN_SEP DN(DocHtmlSummary) \
// forward declarations
#define DN(x) class x;
@@ -272,8 +272,7 @@ class DocStyleChange : public DocNode
Del = (1<<12),
Ins = (1<<13),
S = (1<<14),
- Summary = (1<<16),
- Cite = (1<<17)
+ Cite = (1<<15)
};
DocStyleChange(DocParser *parser,DocNodeVariant *parent,size_t position,Style s,
@@ -793,6 +792,19 @@ class DocHRef : public DocCompoundNode
QCString m_file;
};
+/** Node Html summary */
+class DocHtmlSummary : public DocCompoundNode
+{
+ public:
+ DocHtmlSummary(DocParser *parser,DocNodeVariant *parent,const HtmlAttribList &attribs) :
+ DocCompoundNode(parser,parent), m_attribs(attribs) {}
+ const HtmlAttribList &attribs() const { return m_attribs; }
+ void parse(DocNodeVariant*);
+
+ private:
+ HtmlAttribList m_attribs;
+};
+
/** Node Html details */
class DocHtmlDetails : public DocCompoundNode
{
@@ -801,9 +813,12 @@ class DocHtmlDetails : public DocCompoundNode
DocCompoundNode(parser,parent), m_attribs(attribs) {}
const HtmlAttribList &attribs() const { return m_attribs; }
int parse(DocNodeVariant*);
+ void parseSummary(DocNodeVariant *,HtmlAttribList &attribs);
+ const DocNodeVariant *summary() const { return m_summary.get(); }
private:
HtmlAttribList m_attribs;
+ std::unique_ptr m_summary;
};
/** Node Html heading */
@@ -1265,6 +1280,12 @@ class DocRoot : public DocCompoundNode
//--------------------------------------------------------------------------------------
+/// returns the parent node of a given node \a n or 0 if the node has no parent.
+constexpr DocNodeVariant *parent(DocNodeVariant *n)
+{
+ return n ? std::visit([](auto &&x)->decltype(auto) { return x.parent(); }, *n) : nullptr;
+}
+
/// returns the parent node of a given node \a n or 0 if the node has no parent.
constexpr const DocNodeVariant *parent(const DocNodeVariant *n)
{
diff --git a/src/docparser.cpp b/src/docparser.cpp
index ce8d2a16d..5813f3fc1 100644
--- a/src/docparser.cpp
+++ b/src/docparser.cpp
@@ -562,6 +562,10 @@ void DocParser::errorHandleDefaultToken(DocNodeVariant *parent,int tok,
warn_doc_error(context.fileName,tokenizer.getLineNr(),"Unsupported symbol %s found as part of a %s",
qPrint(context.token->name), qPrint(txt));
break;
+ case TK_HTMLTAG:
+ warn_doc_error(context.fileName,tokenizer.getLineNr(),"Unsupported HTML tag <%s%s> found as part of a %s",
+ context.token->endTag ? "/" : "",qPrint(context.token->name), qPrint(txt));
+ break;
default:
children.append(this,parent,context.token->name);
warn_doc_error(context.fileName,tokenizer.getLineNr(),"Unexpected token %s found as part of a %s",
diff --git a/src/htmldocvisitor.cpp b/src/htmldocvisitor.cpp
index 902519247..c5bfe982e 100644
--- a/src/htmldocvisitor.cpp
+++ b/src/htmldocvisitor.cpp
@@ -119,6 +119,7 @@ static bool mustBeOutsideParagraph(const DocNodeVariant &n)
/* */ DocHtmlBlockQuote,
/* \parblock */ DocParBlock,
/* */ DocHtmlDetails,
+ /* */ DocHtmlSummary,
DocIncOperator >(n))
{
return TRUE;
@@ -525,9 +526,6 @@ void HtmlDocVisitor::operator()(const DocStyleChange &s)
case DocStyleChange::Span:
if (s.enable()) m_t << ""; else m_t << "";
break;
- case DocStyleChange::Summary:
- if (s.enable()) m_t << ""; else m_t << "
";
- break;
}
}
@@ -1275,7 +1273,8 @@ static bool determineIfNeedsTag(const DocPara &p)
DocXRefItem,
DocHtmlBlockQuote,
DocParBlock,
- DocHtmlDetails
+ DocHtmlDetails,
+ DocHtmlSummary
>(*p.parent()))
{
needsTag = TRUE;
@@ -1628,11 +1627,24 @@ void HtmlDocVisitor::operator()(const DocHRef &href)
m_t << "";
}
+void HtmlDocVisitor::operator()(const DocHtmlSummary &s)
+{
+ if (m_hide) return;
+ m_t << "\n";
+ visitChildren(s);
+ m_t << "
\n";
+}
+
void HtmlDocVisitor::operator()(const DocHtmlDetails &d)
{
if (m_hide) return;
forceEndParagraph(d);
m_t << "\n";
+ auto summary = d.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ }
visitChildren(d);
m_t << " \n";
forceStartParagraph(d);
diff --git a/src/htmldocvisitor.h b/src/htmldocvisitor.h
index 510f34979..da453d9a1 100644
--- a/src/htmldocvisitor.h
+++ b/src/htmldocvisitor.h
@@ -78,6 +78,7 @@ class HtmlDocVisitor : public DocVisitor
void operator()(const DocHtmlCaption &);
void operator()(const DocInternal &);
void operator()(const DocHRef &);
+ void operator()(const DocHtmlSummary &);
void operator()(const DocHtmlDetails &);
void operator()(const DocHtmlHeader &);
void operator()(const DocImage &);
diff --git a/src/latexdocvisitor.cpp b/src/latexdocvisitor.cpp
index feb4f9356..2daee8eb1 100644
--- a/src/latexdocvisitor.cpp
+++ b/src/latexdocvisitor.cpp
@@ -378,8 +378,6 @@ void LatexDocVisitor::operator()(const DocStyleChange &s)
break;
case DocStyleChange::Div: /* HTML only */ break;
case DocStyleChange::Span: /* HTML only */ break;
- case DocStyleChange::Summary: /* emulation of the tag inside a tag */
- if (s.enable()) m_t << "{\\bfseries{"; else m_t << "}}\\newline";
break;
}
}
@@ -1409,12 +1407,33 @@ void LatexDocVisitor::operator()(const DocHRef &href)
m_t << "}}";
}
+void LatexDocVisitor::operator()(const DocHtmlSummary &d)
+{
+ if (m_hide) return;
+ m_t << "{\\bfseries{";
+ visitChildren(d);
+ m_t << "}}";
+}
+
void LatexDocVisitor::operator()(const DocHtmlDetails &d)
{
if (m_hide) return;
m_t << "\n\n";
+ auto summary = d.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ m_t << "\\begin{adjustwidth}{1em}{0em}\n";
+ }
visitChildren(d);
- m_t << "\n\n";
+ if (summary)
+ {
+ m_t << "\\end{adjustwidth}\n";
+ }
+ else
+ {
+ m_t << "\n\n";
+ }
}
void LatexDocVisitor::operator()(const DocHtmlHeader &header)
diff --git a/src/latexdocvisitor.h b/src/latexdocvisitor.h
index fcd7f12bc..52a718f0f 100644
--- a/src/latexdocvisitor.h
+++ b/src/latexdocvisitor.h
@@ -80,6 +80,7 @@ class LatexDocVisitor : public DocVisitor
void operator()(const DocHtmlCell &);
void operator()(const DocInternal &);
void operator()(const DocHRef &);
+ void operator()(const DocHtmlSummary &);
void operator()(const DocHtmlDetails &);
void operator()(const DocHtmlHeader &);
void operator()(const DocImage &);
diff --git a/src/mandocvisitor.cpp b/src/mandocvisitor.cpp
index a1ae5227a..e8c12386e 100644
--- a/src/mandocvisitor.cpp
+++ b/src/mandocvisitor.cpp
@@ -188,10 +188,6 @@ void ManDocVisitor::operator()(const DocStyleChange &s)
break;
case DocStyleChange::Div: /* HTML only */ break;
case DocStyleChange::Span: /* HTML only */ break;
- case DocStyleChange::Summary: /* emulation of the tag inside a tag */
- if (s.enable()) m_t << "\\fB"; else m_t << "\\fP\n.PP\n";
- m_firstCol=FALSE;
- break;
}
}
@@ -776,6 +772,13 @@ void ManDocVisitor::operator()(const DocHRef &href)
m_t << "\\fP";
}
+void ManDocVisitor::operator()(const DocHtmlSummary &s)
+{
+ m_t << "\\fB";
+ visitChildren(s);
+ m_t << "\\fP\n.PP\n";
+}
+
void ManDocVisitor::operator()(const DocHtmlDetails &d)
{
if (m_hide) return;
@@ -784,10 +787,19 @@ void ManDocVisitor::operator()(const DocHtmlDetails &d)
m_t << "\n";
m_t << ".PP\n";
}
- m_t << ".RS 4\n"; // TODO: add support for nested detailes sections
+ auto summary = d.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ m_t << ".PP\n";
+ m_t << ".RS 4\n";
+ }
visitChildren(d);
if (!m_firstCol) m_t << "\n";
- m_t << ".RE\n";
+ if (summary)
+ {
+ m_t << ".RE\n";
+ }
m_t << ".PP\n";
m_firstCol=TRUE;
}
diff --git a/src/mandocvisitor.h b/src/mandocvisitor.h
index 43fd19fe2..4473cd2c6 100644
--- a/src/mandocvisitor.h
+++ b/src/mandocvisitor.h
@@ -81,6 +81,7 @@ class ManDocVisitor : public DocVisitor
void operator()(const DocHtmlCell &);
void operator()(const DocInternal &);
void operator()(const DocHRef &);
+ void operator()(const DocHtmlSummary &);
void operator()(const DocHtmlDetails &);
void operator()(const DocHtmlHeader &);
void operator()(const DocImage &);
diff --git a/src/perlmodgen.cpp b/src/perlmodgen.cpp
index f413d1a08..84a3a8dcc 100644
--- a/src/perlmodgen.cpp
+++ b/src/perlmodgen.cpp
@@ -336,6 +336,7 @@ class PerlModDocVisitor : public DocVisitor
void operator()(const DocHtmlCaption &);
void operator()(const DocInternal &);
void operator()(const DocHRef &);
+ void operator()(const DocHtmlSummary &);
void operator()(const DocHtmlDetails &);
void operator()(const DocHtmlHeader &);
void operator()(const DocImage &);
@@ -626,10 +627,6 @@ void PerlModDocVisitor::operator()(const DocStyleChange &s)
case DocStyleChange::Preformatted: style = "preformatted"; break;
case DocStyleChange::Div: style = "div"; break;
case DocStyleChange::Span: style = "span"; break;
- case DocStyleChange::Summary: /* emulation of the tag inside a tag */
- style = "summary";
- break;
-
}
openItem("style");
m_output.addFieldQuotedString("style", style)
@@ -1031,9 +1028,23 @@ void PerlModDocVisitor::operator()(const DocHRef &href)
#endif
}
+void PerlModDocVisitor::operator()(const DocHtmlSummary &summary)
+{
+ openItem("summary");
+ openSubBlock("content");
+ visitChildren(summary);
+ closeSubBlock();
+ closeItem();
+}
+
void PerlModDocVisitor::operator()(const DocHtmlDetails &details)
{
openItem("details");
+ auto summary = details.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ }
openSubBlock("content");
visitChildren(details);
closeSubBlock();
diff --git a/src/printdocvisitor.h b/src/printdocvisitor.h
index 6efb18a3b..01802ec9a 100644
--- a/src/printdocvisitor.h
+++ b/src/printdocvisitor.h
@@ -147,18 +147,6 @@ class PrintDocVisitor
case DocStyleChange::Span:
if (s.enable()) printf(""); else printf("");
break;
- case DocStyleChange::Summary:
- if (s.enable())
- {
- indent_pre();
- printf("\n");
- }
- else
- {
- indent_post();
- printf("
\n");
- }
- break;
}
}
void operator()(const DocVerbatim &s)
@@ -518,6 +506,19 @@ class PrintDocVisitor
indent_post();
printf("\n");
}
+ void operator()(const DocHtmlSummary &summary)
+ {
+ indent_pre();
+ printf("\n");
+ visitChildren(summary);
+ indent_post();
+ printf("
\n");
+ }
void operator()(const DocHtmlDetails &details)
{
indent_pre();
@@ -527,6 +528,11 @@ class PrintDocVisitor
printf(" %s=\"%s\"",qPrint(opt.name),qPrint(opt.value));
}
printf(">\n");
+ auto summary = details.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ }
visitChildren(details);
indent_post();
printf(" \n");
diff --git a/src/rtfdocvisitor.cpp b/src/rtfdocvisitor.cpp
index 1e2afaa45..13b1f33a7 100644
--- a/src/rtfdocvisitor.cpp
+++ b/src/rtfdocvisitor.cpp
@@ -286,7 +286,6 @@ void RTFDocVisitor::operator()(const DocStyleChange &s)
break;
case DocStyleChange::Div: /* HTML only */ break;
case DocStyleChange::Span: /* HTML only */ break;
- case DocStyleChange::Summary: /* emulation of the tag inside a tag */
if (s.enable()) m_t << "{\\b "; else m_t << "}\\par ";
break;
}
@@ -1131,25 +1130,34 @@ void RTFDocVisitor::operator()(const DocHRef &href)
m_lastIsPara=FALSE;
}
+void RTFDocVisitor::operator()(const DocHtmlSummary &s)
+{
+ if (m_hide) return;
+ m_t << "{\\b ";
+ visitChildren(s);
+ m_t << "}\\par ";
+}
+
void RTFDocVisitor::operator()(const DocHtmlDetails &d)
{
if (m_hide) return;
- //m_lastIsPara=TRUE;
- //m_t << "{\n";
- //m_t << "\\par\n";
- //visitChildren(d);
- //m_t << "\\par";
- //m_t << "}\n";
- //m_lastIsPara=TRUE;
DBG_RTF("{\\comment RTFDocVisitor::operator()(const DocHtmlDetails &)}\n");
if (!m_lastIsPara) m_t << "\\par\n";
- m_t << "{"; // start desc
- incIndentLevel();
- m_t << rtf_Style_Reset << getStyle("DescContinue");
+ auto summary = d.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ m_t << "{"; // start desc
+ incIndentLevel();
+ m_t << rtf_Style_Reset << getStyle("DescContinue");
+ }
visitChildren(d);
if (!m_lastIsPara) m_t << "\\par\n";
- decIndentLevel();
- m_t << "}"; // end desc
+ if (summary)
+ {
+ decIndentLevel();
+ m_t << "}"; // end desc
+ }
m_lastIsPara=TRUE;
}
diff --git a/src/rtfdocvisitor.h b/src/rtfdocvisitor.h
index fc1b539b7..42d9a3523 100644
--- a/src/rtfdocvisitor.h
+++ b/src/rtfdocvisitor.h
@@ -80,6 +80,7 @@ class RTFDocVisitor : public DocVisitor
void operator()(const DocHtmlCell &);
void operator()(const DocInternal &);
void operator()(const DocHRef &);
+ void operator()(const DocHtmlSummary &);
void operator()(const DocHtmlDetails &);
void operator()(const DocHtmlHeader &);
void operator()(const DocImage &);
diff --git a/src/textdocvisitor.h b/src/textdocvisitor.h
index 5360c351b..2ed6de5d3 100644
--- a/src/textdocvisitor.h
+++ b/src/textdocvisitor.h
@@ -85,6 +85,7 @@ class TextDocVisitor : public DocVisitor
void operator()(const DocHtmlCaption &c) { visitChildren(c); }
void operator()(const DocInternal &i) { visitChildren(i); }
void operator()(const DocHRef &h) { visitChildren(h); }
+ void operator()(const DocHtmlSummary &s) { visitChildren(s); }
void operator()(const DocHtmlDetails &d) { visitChildren(d); }
void operator()(const DocHtmlHeader &h) { visitChildren(h); }
void operator()(const DocImage &i) { visitChildren(i); }
diff --git a/src/xmldocvisitor.cpp b/src/xmldocvisitor.cpp
index 90a9aa282..4d52adc6c 100644
--- a/src/xmldocvisitor.cpp
+++ b/src/xmldocvisitor.cpp
@@ -294,9 +294,6 @@ void XmlDocVisitor::operator()(const DocStyleChange &s)
break;
case DocStyleChange::Div: /* HTML only */ break;
case DocStyleChange::Span: /* HTML only */ break;
- case DocStyleChange::Summary:
- if (s.enable()) m_t << ""; else m_t << "
";
- break;
}
}
@@ -887,10 +884,23 @@ void XmlDocVisitor::operator()(const DocHRef &href)
m_t << "";
}
+void XmlDocVisitor::operator()(const DocHtmlSummary &s)
+{
+ if (m_hide) return;
+ m_t << "";
+ visitChildren(s);
+ m_t << "
";
+}
+
void XmlDocVisitor::operator()(const DocHtmlDetails &d)
{
if (m_hide) return;
m_t << "";
+ auto summary = d.summary();
+ if (summary)
+ {
+ std::visit(*this,*summary);
+ }
visitChildren(d);
m_t << " ";
}
diff --git a/src/xmldocvisitor.h b/src/xmldocvisitor.h
index 0670fe590..7df8e3be2 100644
--- a/src/xmldocvisitor.h
+++ b/src/xmldocvisitor.h
@@ -82,6 +82,7 @@ class XmlDocVisitor : public DocVisitor
void operator()(const DocHtmlCaption &);
void operator()(const DocInternal &);
void operator()(const DocHRef &);
+ void operator()(const DocHtmlSummary &);
void operator()(const DocHtmlDetails &);
void operator()(const DocHtmlHeader &);
void operator()(const DocImage &);
diff --git a/templates/latex/header.tex b/templates/latex/header.tex
index bb256ec83..1bab36738 100644
--- a/templates/latex/header.tex
+++ b/templates/latex/header.tex
@@ -77,6 +77,7 @@
left=2.5cm,%
right=2.5cm%
}
+ \usepackage{changepage}
% Allow a bit of overflow to go unnoticed by other means
\tolerance=750
diff --git a/testing/060/class_details_c_s_style.xml b/testing/060/class_details_c_s_style.xml
new file mode 100644
index 000000000..3ebcb3e5c
--- /dev/null
+++ b/testing/060/class_details_c_s_style.xml
@@ -0,0 +1,15 @@
+
+
+
+ DetailsCSStyle
+
+ Summary C# style.
+
+
+ Details below
+
+
+
+
+
+
diff --git a/testing/060/class_details_nested.xml b/testing/060/class_details_nested.xml
new file mode 100644
index 000000000..29df00dd1
--- /dev/null
+++ b/testing/060/class_details_nested.xml
@@ -0,0 +1,14 @@
+
+
+
+ DetailsNested
+
+
+
+ Nested details Summary at top
Some text Nested summary at bottom
More details.
+
+
+
+
+
+
diff --git a/testing/060/class_details_summary_at_bottom.xml b/testing/060/class_details_summary_at_bottom.xml
new file mode 100644
index 000000000..08760e83c
--- /dev/null
+++ b/testing/060/class_details_summary_at_bottom.xml
@@ -0,0 +1,14 @@
+
+
+
+ DetailsSummaryAtBottom
+
+
+
+ Before details. Summary at the bottom
Details body After details.
+
+
+
+
+
+
diff --git a/testing/060/class_details_summary_at_top.xml b/testing/060/class_details_summary_at_top.xml
new file mode 100644
index 000000000..689750d09
--- /dev/null
+++ b/testing/060/class_details_summary_at_top.xml
@@ -0,0 +1,14 @@
+
+
+
+ DetailsSummaryAtTop
+
+
+
+ Before details. Summary on top
Details body After details.
+
+
+
+
+
+
diff --git a/testing/060/class_details_without_summary.xml b/testing/060/class_details_without_summary.xml
new file mode 100644
index 000000000..a003c86af
--- /dev/null
+++ b/testing/060/class_details_without_summary.xml
@@ -0,0 +1,14 @@
+
+
+
+ DetailsWithoutSummary
+
+
+
+ Before details. Details body without summary After details.
+
+
+
+
+
+
diff --git a/testing/060_details.cpp b/testing/060_details.cpp
new file mode 100644
index 000000000..47b50537a
--- /dev/null
+++ b/testing/060_details.cpp
@@ -0,0 +1,53 @@
+// objective: test the and commands
+// check: class_details_c_s_style.xml
+// check: class_details_nested.xml
+// check: class_details_summary_at_top.xml
+// check: class_details_summary_at_bottom.xml
+// check: class_details_without_summary.xml
+/**
+ * Before details.
+ *
+ * Summary on top
+ * Details body
+ *
+ * After details.
+ */
+class DetailsSummaryAtTop {};
+
+/**
+ * Before details.
+ *
+ * Details body without summary
+ *
+ * After details.
+ */
+class DetailsWithoutSummary {};
+
+/**
+ * Before details.
+ *
+ * Details body
+ * Summary at the bottom
+ *
+ * After details.
+ */
+class DetailsSummaryAtBottom {};
+
+/**
+ * Summary C# style
+ * Details below
+ */
+class DetailsCSStyle {};
+
+/**
+ * Nested details
+ *
+ * Summary at top
+ * Some text
+ *
+ * More details.
+ * Nested summary at bottom
+ *
+ *
+ */
+class DetailsNested {};