[LyX/master] Add i, ii, iii, iv suffixes to CSS class as well in the case of itemizations

Richard Kimberly Heck rikiheck at lyx.org
Sun Dec 4 18:38:59 UTC 2022


commit 5ac560cfa1096c94cf989cc541fb5ac122999e05
Author: Richard Kimberly Heck <rikiheck at lyx.org>
Date:   Sun Dec 4 14:34:29 2022 -0500

    Add i, ii, iii, iv suffixes to CSS class as well in the case of itemizations
---
 src/Layout.cpp       |    6 +++---
 src/output_xhtml.cpp |   15 +++++++++------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/src/Layout.cpp b/src/Layout.cpp
index 7578d15..88d5539 100644
--- a/src/Layout.cpp
+++ b/src/Layout.cpp
@@ -1825,9 +1825,9 @@ string const & Layout::htmlattr() const
 
 string const & Layout::htmlclass() const
 {
-	// If it's an enumeration, then we recalculate the class each time through
-	// unless it has been given explicitly. So we do nothing here.
-	if (htmlclass_.empty() && labeltype != LABEL_ENUMERATE)
+	// If it's an enumeration or itemize list, then we recalculate the class each
+	// time through (unless it has been given explicitly). So we do nothing here.
+	if (htmlclass_.empty() && labeltype != LABEL_ENUMERATE && labeltype != LABEL_ITEMIZE)
 		htmlclass_ = defaultCSSClass();
 	return htmlclass_;
 }
diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp
index 0c4bdb9..c812966 100644
--- a/src/output_xhtml.cpp
+++ b/src/output_xhtml.cpp
@@ -408,16 +408,19 @@ ParagraphList::const_iterator makeEnvironment(Buffer const & buf,
 	depth_type const origdepth = pbegin->params().depth();
 
 	// open tag for this environment
-	if (bstyle.labeltype == LABEL_ENUMERATE && bstyle.htmlclass().empty()) {
+	if ((bstyle.labeltype == LABEL_ENUMERATE || bstyle.labeltype == LABEL_ITEMIZE)
+		&& bstyle.htmlclass().empty()) {
 		// In this case, we have to calculate the CSS class ourselves, each time
 		// through
-		// FIXME We assume in these cases that the standard enumeration counter
-		// is being used. (We also do not deal with 'resume' counters, though I'm
-		// not sure that can be done at all.)
+		// FIXME We assume in these cases that the standard counters are being used.
+		// (We also do not deal with 'resume' counters, though I'm not sure that can
+		// be done at all in HTML.)
 
-		// Code borrowed from Buffer::Impl::setLabel
+		// Code adapated from Buffer::Impl::setLabel
 		docstring enumcounter = bstyle.counter.empty() ?
-					from_ascii("enum") : bstyle.counter;
+					(bstyle.labeltype == LABEL_ENUMERATE ?
+						from_ascii("lyxenum") : from_ascii("lyxitem") ) :
+					bstyle.counter;
 		switch (par->itemdepth) {
 		case 2:
 			enumcounter += 'i';


More information about the lyx-cvs mailing list