commit 29b408c23012774d9ac75d9b9172d7a5e574af21
Author: Thibaut Cuvelier <[email protected]>
Date:   Wed Jul 16 17:30:01 2025 +0200

    MathML: add classes for <mtable> so that users can play more freely with 
styles.
---
 src/mathed/InsetMathGrid.cpp   |  2 +-
 src/mathed/InsetMathHull.cpp   | 18 ++++++++++++++----
 src/mathed/InsetMathMatrix.cpp |  2 +-
 3 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/mathed/InsetMathGrid.cpp b/src/mathed/InsetMathGrid.cpp
index 8fc485c9fe..4a712a9d3f 100644
--- a/src/mathed/InsetMathGrid.cpp
+++ b/src/mathed/InsetMathGrid.cpp
@@ -1167,7 +1167,7 @@ void InsetMathGrid::mathmlize(MathMLStream & ms) const
 {
        bool const havetable = nrows() > 1 || ncols() > 1;
        if (havetable)
-               ms << MTag("mtable");
+               ms << MTag("mtable", R"(class="grid")");
        char const * const celltag = havetable ? "mtd" : "mrow";
        for (row_type row = 0; row < nrows(); ++row) {
                if (havetable)
diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index 74c0a73f3e..a77c820c0f 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2576,17 +2576,27 @@ void InsetMathHull::mathmlize(MathMLStream & ms) const
        }
 
        // More complex case: wrap elements in a table.
-    if (getType() == hullSimple) {
-        ms << MTag("mtable");
+       if (getType() == hullSimple) {
+        ms << MTag("mtable",
+               // Use a different class value if the table contains
+                       // an equation number so that users can style 
appropriately.
+                       haveNumbers() ? R"(class="hull numbered")" : 
R"(class="hull")"
+        );
     } else if (getType() >= hullAlign && getType() <= hullXXAlignAt) {
                // hullAlign, hullAlignAt, hullXAlignAt, hullXXAlignAt
         string alignment;
         for (col_type col = 0; col < ncols(); ++col) {
             alignment += (col % 2) ? "left " : "right ";
         }
-        ms << MTag("mtable", "displaystyle='true' columnalign='" + alignment + 
"'");
+        ms << MTag("mtable", R"(displaystyle="true" columnalign=")" + 
alignment + R"(" class="align")");
     } else {
-        ms << MTag("mtable", "displaystyle='true'");
+       // Use a different class value if the table contains
+       // an equation number so that users can style appropriately.
+       std::string attr = R"(displaystyle="true" class="hull)";
+       if (haveNumbers())
+               attr += " numbered";
+       attr += R"(")";
+        ms << MTag("mtable", attr);
     }
 
        for (row_type row = 0; row < nrows(); ++row) {
diff --git a/src/mathed/InsetMathMatrix.cpp b/src/mathed/InsetMathMatrix.cpp
index d7b241c011..aec0359a32 100644
--- a/src/mathed/InsetMathMatrix.cpp
+++ b/src/mathed/InsetMathMatrix.cpp
@@ -114,7 +114,7 @@ void InsetMathMatrix::mathmlize(MathMLStream & ms) const
        ms << MTagInline("mo", "form='prefix' fence='true' stretchy='true' 
symmetric='true' lspace='0.1666em'")
           << convertDelimToXMLEscape(left_)
           << ETagInline("mo")
-          << MTag("mtable");
+          << MTag("mtable", R"(class="matrix")");
        for (row_type row = 0; row < nrows(); ++row) {
                ms << MTag("mtr");
                for (col_type col = 0; col < ncols(); ++col) {
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to