From 24d21424af969d5416c471f2b689675069b37c8e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 22 Aug 2023 15:41:13 +0200 Subject: Allow nested lists in documentation for HTML output --- cli/cli/context.cxx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'cli/cli/context.cxx') diff --git a/cli/cli/context.cxx b/cli/cli/context.cxx index f62ff07..2c6a733 100644 --- a/cli/cli/context.cxx +++ b/cli/cli/context.cxx @@ -1338,8 +1338,8 @@ format (semantics::scope& scope, string const& s, bool para) stack blocks; blocks.push (block (block::text, para, "")); // Top-level. - // Number of li in ol. Since we don't support nested lists, we don't - // need to push it into the stack. + // Number of li in ol. Since we don't support nested lists (except in HTML + // where this is unused), we don't need to push it into the stack. // size_t ol_count (0); @@ -1617,7 +1617,10 @@ format (semantics::scope& scope, string const& s, bool para) case block::dl: good = (k == block::li); break; case block::li: good = (k == block::note || k == block::text || - k == block::pre ); break; + k == block::pre || + (ot == ot_html && (k == block::ul || + k == block::ol || + k == block::dl))); break; case block::note: good = (k == block::text || k == block::pre || (ot == ot_html && (k == block::ul || @@ -1729,7 +1732,7 @@ format (semantics::scope& scope, string const& s, bool para) { case block::h: blocks.push (block (k, false, id, header)); break; case block::ul: - case block::ol: ol_count = 0; // Fall through. + case block::ol: if (ot != ot_html) ol_count = 0; // Fall through. case block::dl: blocks.push (block (k, true, id)); break; case block::li: { @@ -1737,9 +1740,12 @@ format (semantics::scope& scope, string const& s, bool para) { case block::ol: { - ostringstream os; - os << ++ol_count; - header = os.str (); + if (ot != ot_html) + { + ostringstream os; + os << ++ol_count; + header = os.str (); + } break; } case block::dl: -- cgit v1.1