[LyX/master] XHTML: support NONE as item tag when no item tag should be output.

Thibaut Cuvelier tcuvelier at lyx.org
Fri Dec 9 01:00:07 UTC 2022


commit 5b7fbb419010b574b2e7886739bd939bc2d6f07a
Author: Thibaut Cuvelier <tcuvelier at lyx.org>
Date:   Fri Dec 9 02:48:52 2022 +0100

    XHTML: support NONE as item tag when no item tag should be output.
    
    This patch mimics a similar feature for DocBook (albeit not as pervasive).
---
 src/output_xhtml.cpp |   24 +++++++++++++++---------
 1 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index 4418f28..f01b0b8 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -212,27 +212,33 @@ inline void closeLabelTag(XMLStream & xs, Layout const & lay)
 
 inline void openItemTag(XMLStream & xs, Layout const & lay)
 {
-	xs << xml::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
+	if (lay.htmlitemtag() != "NONE") {
+		xs << xml::StartTag(lay.htmlitemtag(), lay.htmlitemattr(), true);
+	}
 }
 
 
 void openItemTag(XMLStream & xs, Layout const & lay,
              ParagraphParameters const & params)
 {
-	// FIXME Are there other things we should handle here?
-	string const align = alignmentToCSS(params.align());
-	if (align.empty()) {
-		openItemTag(xs, lay);
-		return;
+	if (lay.htmlitemtag() != "NONE") {
+		// FIXME Are there other things we should handle here?
+		string const align = alignmentToCSS(params.align());
+		if (align.empty()) {
+			openItemTag(xs, lay);
+			return;
+		}
+		string attrs = lay.htmlGetAttrString() + " style='text-align: " + align + ";'";
+		xs << xml::StartTag(lay.htmlitemtag(), attrs);
 	}
-	string attrs = lay.htmlGetAttrString() + " style='text-align: " + align + ";'";
-	xs << xml::StartTag(lay.htmlitemtag(), attrs);
 }
 
 
 inline void closeItemTag(XMLStream & xs, Layout const & lay)
 {
-	xs << xml::EndTag(lay.htmlitemtag());
+	if (lay.htmlitemtag() != "NONE") {
+		xs << xml::EndTag(lay.htmlitemtag());
+	}
 }
 
 // end of convenience functions


More information about the lyx-cvs mailing list