Skip to content

Commit 4a02703

Browse files
committed
Merge branch 'mtable-attributes' into alpha
2 parents a56152e + a307315 commit 4a02703

File tree

5 files changed

+789
-169
lines changed

5 files changed

+789
-169
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,16 @@ 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 = this.addInheritedAttributes(attributes, {
88+
columnalign: this.attributes.get('columnalign'),
89+
rowalign: 'center'
90+
});
91+
const ralign = (this.attributes.get('rowalign') as string)
92+
.replace(/^\s+/, '').replace(/\s+$/, '').split(/ +/);
93+
for (const child of this.childNodes) {
94+
attributes.rowalign[1] = ralign.shift() || attributes.rowalign[1];
95+
child.setInheritedAttributes(attributes, display, level, prime);
96+
}
8897
}
8998

9099
/*

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,19 @@ export class MmlMtr extends AbstractMmlNode {
6464
.appendChild(child);
6565
}
6666
}
67-
super.setChildInheritedAttributes(attributes, display, level, prime);
67+
const calign = (this.attributes.get('columnalign') as string)
68+
.replace(/^\s+/, '').replace(/\s+$/, '').split(/ +/);
69+
if (this.arity === 1) {
70+
calign.unshift(this.parent.attributes.get('side') as string);
71+
}
72+
attributes = this.addInheritedAttributes(attributes, {
73+
rowalign: this.attributes.get('rowalign'),
74+
columnalign: 'center'
75+
});
76+
for (const child of this.childNodes) {
77+
attributes.columnalign[1] = calign.shift() || attributes.columnalign[1];
78+
child.setInheritedAttributes(attributes, display, level, prime);
79+
}
6880
}
6981

7082
/*

0 commit comments

Comments
 (0)