mirror of
https://github.com/siemens-mobile-hacks/doxygen.git
synced 2026-11-26 23:57:52 +00:00
Improve handling of <details> and <summary> tags
This commit is contained in:
parent
6072c24455
commit
61caf5d22f
26 changed files with 351 additions and 78 deletions
|
|
@ -712,20 +712,9 @@ STopt [^\n@\\]*
|
|||
{
|
||||
setOutput(yyscanner,OutputBrief);
|
||||
}
|
||||
else
|
||||
else // HTML5 style <summary> as part of <details> section.
|
||||
{
|
||||
int id = yyextra->HTMLDetailsSummary.back();
|
||||
if (id == 0)
|
||||
{
|
||||
addOutput(yyscanner,"\\htmlonly </p> \\endhtmlonly");
|
||||
addOutput(yyscanner,yytext);
|
||||
}
|
||||
else
|
||||
{
|
||||
addOutput(yyscanner,"<p>");
|
||||
}
|
||||
yyextra->HTMLDetailsSummary.pop_back();
|
||||
yyextra->HTMLDetailsSummary.push_back(id+1);
|
||||
addOutput(yyscanner,yytext);
|
||||
}
|
||||
}
|
||||
<Comment>"<"{REMARKS}">" { // start of a .NET XML style detailed description
|
||||
|
|
@ -735,15 +724,12 @@ STopt [^\n@\\]*
|
|||
<Comment>"</"{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 <p> \\endhtmlonly");
|
||||
}
|
||||
else addOutput(yyscanner,"</p>");
|
||||
addOutput(yyscanner,yytext);
|
||||
}
|
||||
else
|
||||
{
|
||||
setOutput(yyscanner,OutputDoc);
|
||||
}
|
||||
else setOutput(yyscanner,OutputDoc);
|
||||
}
|
||||
<Comment>"</"{REMARKS}">" { // end of a brief or detailed description
|
||||
setOutput(yyscanner,OutputDoc);
|
||||
|
|
|
|||
|
|
@ -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 <summary> tag inside a <details> tag */
|
||||
if (s.enable()) m_t << "<para><emphasis role=\"bold\">"; else m_t << "</emphasis></para>";
|
||||
break;
|
||||
}
|
||||
|
|
@ -1172,11 +1171,25 @@ DB_VIS_C
|
|||
m_t << "</link>";
|
||||
}
|
||||
|
||||
void DocbookDocVisitor::operator()(const DocHtmlSummary &s)
|
||||
{
|
||||
DB_VIS_C
|
||||
if (m_hide) return;
|
||||
m_t << "<para><emphasis role=\"bold\">";
|
||||
visitChildren(s);
|
||||
m_t << "</emphasis></para>";
|
||||
}
|
||||
|
||||
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 << "<para>";
|
||||
visitChildren(d);
|
||||
m_t << "</para>";
|
||||
|
|
|
|||
|
|
@ -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 &);
|
||||
|
|
|
|||
|
|
@ -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 "<invalid>";
|
||||
}
|
||||
|
|
@ -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 </summary>
|
||||
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<DocNodeVariant>(DocHtmlSummary(parser(),thisVariant,attribs));
|
||||
DocHtmlSummary *summary = &std::get<DocHtmlSummary>(*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<DocHtmlDetails>(*n)) n=::parent(n);
|
||||
DocHtmlDetails *d = std::get_if<DocHtmlDetails>(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<DocStyleChange>(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:
|
||||
|
|
|
|||
|
|
@ -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<DocNodeVariant> 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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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<DocWord>(this,parent,context.token->name);
|
||||
warn_doc_error(context.fileName,tokenizer.getLineNr(),"Unexpected token %s found as part of a %s",
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ static bool mustBeOutsideParagraph(const DocNodeVariant &n)
|
|||
/* <blockquote> */ DocHtmlBlockQuote,
|
||||
/* \parblock */ DocParBlock,
|
||||
/* <details> */ DocHtmlDetails,
|
||||
/* <summary> */ DocHtmlSummary,
|
||||
DocIncOperator >(n))
|
||||
{
|
||||
return TRUE;
|
||||
|
|
@ -525,9 +526,6 @@ void HtmlDocVisitor::operator()(const DocStyleChange &s)
|
|||
case DocStyleChange::Span:
|
||||
if (s.enable()) m_t << "<span" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</span>";
|
||||
break;
|
||||
case DocStyleChange::Summary:
|
||||
if (s.enable()) m_t << "<summary" << htmlAttribsToString(s.attribs()) << ">"; else m_t << "</summary>";
|
||||
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 << "</a>";
|
||||
}
|
||||
|
||||
void HtmlDocVisitor::operator()(const DocHtmlSummary &s)
|
||||
{
|
||||
if (m_hide) return;
|
||||
m_t << "<summary " << htmlAttribsToString(s.attribs()) << ">\n";
|
||||
visitChildren(s);
|
||||
m_t << "</summary>\n";
|
||||
}
|
||||
|
||||
void HtmlDocVisitor::operator()(const DocHtmlDetails &d)
|
||||
{
|
||||
if (m_hide) return;
|
||||
forceEndParagraph(d);
|
||||
m_t << "<details " << htmlAttribsToString(d.attribs()) << ">\n";
|
||||
auto summary = d.summary();
|
||||
if (summary)
|
||||
{
|
||||
std::visit(*this,*summary);
|
||||
}
|
||||
visitChildren(d);
|
||||
m_t << "</details>\n";
|
||||
forceStartParagraph(d);
|
||||
|
|
|
|||
|
|
@ -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 &);
|
||||
|
|
|
|||
|
|
@ -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 <summary> tag inside a <details> 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)
|
||||
|
|
|
|||
|
|
@ -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 &);
|
||||
|
|
|
|||
|
|
@ -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 <summary> tag inside a <details> 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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 &);
|
||||
|
|
|
|||
|
|
@ -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 <summary> tag inside a <details> 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();
|
||||
|
|
|
|||
|
|
@ -147,18 +147,6 @@ class PrintDocVisitor
|
|||
case DocStyleChange::Span:
|
||||
if (s.enable()) printf("<span>"); else printf("</span>");
|
||||
break;
|
||||
case DocStyleChange::Summary:
|
||||
if (s.enable())
|
||||
{
|
||||
indent_pre();
|
||||
printf("<summary>\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
indent_post();
|
||||
printf("</summary>\n");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
void operator()(const DocVerbatim &s)
|
||||
|
|
@ -518,6 +506,19 @@ class PrintDocVisitor
|
|||
indent_post();
|
||||
printf("</a>\n");
|
||||
}
|
||||
void operator()(const DocHtmlSummary &summary)
|
||||
{
|
||||
indent_pre();
|
||||
printf("<summary");
|
||||
for (const auto &opt : summary.attribs())
|
||||
{
|
||||
printf(" %s=\"%s\"",qPrint(opt.name),qPrint(opt.value));
|
||||
}
|
||||
printf(">\n");
|
||||
visitChildren(summary);
|
||||
indent_post();
|
||||
printf("</summary>\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("</details>\n");
|
||||
|
|
|
|||
|
|
@ -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 <summary> tag inside a <details> 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 &);
|
||||
|
|
|
|||
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -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 << "<summary>"; else m_t << "</summary>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -887,10 +884,23 @@ void XmlDocVisitor::operator()(const DocHRef &href)
|
|||
m_t << "</ulink>";
|
||||
}
|
||||
|
||||
void XmlDocVisitor::operator()(const DocHtmlSummary &s)
|
||||
{
|
||||
if (m_hide) return;
|
||||
m_t << "<summary>";
|
||||
visitChildren(s);
|
||||
m_t << "</summary>";
|
||||
}
|
||||
|
||||
void XmlDocVisitor::operator()(const DocHtmlDetails &d)
|
||||
{
|
||||
if (m_hide) return;
|
||||
m_t << "<details>";
|
||||
auto summary = d.summary();
|
||||
if (summary)
|
||||
{
|
||||
std::visit(*this,*summary);
|
||||
}
|
||||
visitChildren(d);
|
||||
m_t << "</details>";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 &);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
15
testing/060/class_details_c_s_style.xml
Normal file
15
testing/060/class_details_c_s_style.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
|
||||
<compounddef id="class_details_c_s_style" kind="class" language="C++" prot="public">
|
||||
<compoundname>DetailsCSStyle</compoundname>
|
||||
<briefdescription>
|
||||
<para>Summary C# style. </para>
|
||||
</briefdescription>
|
||||
<detaileddescription>
|
||||
<para>Details below </para>
|
||||
</detaileddescription>
|
||||
<location file="060_details.cpp" line="40" column="1" bodyfile="060_details.cpp" bodystart="40" bodyend="40"/>
|
||||
<listofallmembers>
|
||||
</listofallmembers>
|
||||
</compounddef>
|
||||
</doxygen>
|
||||
14
testing/060/class_details_nested.xml
Normal file
14
testing/060/class_details_nested.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
|
||||
<compounddef id="class_details_nested" kind="class" language="C++" prot="public">
|
||||
<compoundname>DetailsNested</compoundname>
|
||||
<briefdescription>
|
||||
</briefdescription>
|
||||
<detaileddescription>
|
||||
<para>Nested details <details><summary>Summary at top</summary><para>Some text <details><summary>Nested summary at bottom</summary><para>More details. </para></details></para></details></para>
|
||||
</detaileddescription>
|
||||
<location file="060_details.cpp" line="53" column="1" bodyfile="060_details.cpp" bodystart="53" bodyend="53"/>
|
||||
<listofallmembers>
|
||||
</listofallmembers>
|
||||
</compounddef>
|
||||
</doxygen>
|
||||
14
testing/060/class_details_summary_at_bottom.xml
Normal file
14
testing/060/class_details_summary_at_bottom.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
|
||||
<compounddef id="class_details_summary_at_bottom" kind="class" language="C++" prot="public">
|
||||
<compoundname>DetailsSummaryAtBottom</compoundname>
|
||||
<briefdescription>
|
||||
</briefdescription>
|
||||
<detaileddescription>
|
||||
<para>Before details. <details><summary>Summary at the bottom</summary><para>Details body </para></details>After details. </para>
|
||||
</detaileddescription>
|
||||
<location file="060_details.cpp" line="34" column="1" bodyfile="060_details.cpp" bodystart="34" bodyend="34"/>
|
||||
<listofallmembers>
|
||||
</listofallmembers>
|
||||
</compounddef>
|
||||
</doxygen>
|
||||
14
testing/060/class_details_summary_at_top.xml
Normal file
14
testing/060/class_details_summary_at_top.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
|
||||
<compounddef id="class_details_summary_at_top" kind="class" language="C++" prot="public">
|
||||
<compoundname>DetailsSummaryAtTop</compoundname>
|
||||
<briefdescription>
|
||||
</briefdescription>
|
||||
<detaileddescription>
|
||||
<para>Before details. <details><summary>Summary on top</summary><para>Details body </para></details>After details. </para>
|
||||
</detaileddescription>
|
||||
<location file="060_details.cpp" line="15" column="1" bodyfile="060_details.cpp" bodystart="15" bodyend="15"/>
|
||||
<listofallmembers>
|
||||
</listofallmembers>
|
||||
</compounddef>
|
||||
</doxygen>
|
||||
14
testing/060/class_details_without_summary.xml
Normal file
14
testing/060/class_details_without_summary.xml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="" xml:lang="en-US">
|
||||
<compounddef id="class_details_without_summary" kind="class" language="C++" prot="public">
|
||||
<compoundname>DetailsWithoutSummary</compoundname>
|
||||
<briefdescription>
|
||||
</briefdescription>
|
||||
<detaileddescription>
|
||||
<para>Before details. <details><para>Details body without summary </para></details>After details. </para>
|
||||
</detaileddescription>
|
||||
<location file="060_details.cpp" line="24" column="1" bodyfile="060_details.cpp" bodystart="24" bodyend="24"/>
|
||||
<listofallmembers>
|
||||
</listofallmembers>
|
||||
</compounddef>
|
||||
</doxygen>
|
||||
53
testing/060_details.cpp
Normal file
53
testing/060_details.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
// objective: test the <details> and <summary> 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.
|
||||
* <details>
|
||||
* <summary>Summary on top</summary>
|
||||
* Details body
|
||||
* </details>
|
||||
* After details.
|
||||
*/
|
||||
class DetailsSummaryAtTop {};
|
||||
|
||||
/**
|
||||
* Before details.
|
||||
* <details>
|
||||
* Details body without summary
|
||||
* </details>
|
||||
* After details.
|
||||
*/
|
||||
class DetailsWithoutSummary {};
|
||||
|
||||
/**
|
||||
* Before details.
|
||||
* <details>
|
||||
* Details body
|
||||
* <summary>Summary at the bottom</summary>
|
||||
* </details>
|
||||
* After details.
|
||||
*/
|
||||
class DetailsSummaryAtBottom {};
|
||||
|
||||
/**
|
||||
* <summary>Summary C# style</summary>
|
||||
* Details below
|
||||
*/
|
||||
class DetailsCSStyle {};
|
||||
|
||||
/**
|
||||
* Nested details
|
||||
* <details>
|
||||
* <summary>Summary at top</summary>
|
||||
* Some text
|
||||
* <details>
|
||||
* More details.
|
||||
* <summary>Nested summary at bottom</summary>
|
||||
* </details>
|
||||
* </details>
|
||||
*/
|
||||
class DetailsNested {};
|
||||
Loading…
Add table
Reference in a new issue