Skip to content

Commit d3f9570

Browse files
committed
Have mtr and mtd inherit rowalign and columnalign properly
1 parent 5c4c0ac commit d3f9570

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

mathjax3-ts/core/MmlTree/MmlNodes/mtable.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,14 @@ export class MmlMtable extends AbstractMmlNode {
8484
}
8585
}
8686
display = !!(this.attributes.getExplicit('displaystyle') || this.attributes.getDefault('displaystyle'));
87-
super.setChildInheritedAttributes(attributes, display, level, prime);
87+
attributes.columnalign = [this.kind, this.attributes.get('columnalign')];
88+
attributes.rowalign = [this.kind, 'center'];
89+
const ralign = (this.attributes.get('rowalign') as string)
90+
.replace(/^\s+/, '').replace(/\s+$/, '').split(/ +/);
91+
for (const child of this.childNodes) {
92+
attributes.rowalign[1] = ralign.shift() || attributes.rowalign[1];
93+
child.setInheritedAttributes(attributes, display, level, prime);
94+
}
8895
}
8996

9097
/*

mathjax3-ts/core/MmlTree/MmlNodes/mtr.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,14 @@ export class MmlMtr extends AbstractMmlNode {
6464
.appendChild(child);
6565
}
6666
}
67-
super.setChildInheritedAttributes(attributes, display, level, prime);
67+
attributes.rowalign = [this.kind, this.attributes.get('rowalign')];
68+
attributes.columnalign = [this.kind, 'center'];
69+
const calign = (this.attributes.get('columnalign') as string)
70+
.replace(/^\s+/, '').replace(/\s+$/, '').split(/ +/);
71+
for (const child of this.childNodes) {
72+
attributes.columnalign[1] = calign.shift() || attributes.columnalign[1];
73+
child.setInheritedAttributes(attributes, display, level, prime);
74+
}
6875
}
6976

7077
/*

0 commit comments

Comments
 (0)