-
Notifications
You must be signed in to change notification settings - Fork 233
Add support for indentalign and indentshift #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ercentage widths to parent elements.
zorkow
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly trivialities.
One suggestion: Introduce a constant on bbox for the '100%' string.
| // Force inheritance of shift and align values (since they are needed to output tables with labels) | ||
| // but make sure they are not given explicitly on the <mtable> tag. | ||
| // | ||
| for (const name of ['indentalign', 'indentalignfirst', 'indentshift', 'indentshiftfirst']) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it make sense to put the 'indentXY' elements into a constant list, so it can be reused. It is used again below,
mathjax3-ts/output/chtml/Wrapper.ts
Outdated
| */ | ||
| protected getAlignShift() { | ||
| let {indentalign, indentshift, indentalignfirst, indentshiftfirst} = | ||
| this.node.attributes.getList('indentalign', 'indentshift', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See above comment.
mathjax3-ts/output/chtml/Wrapper.ts
Outdated
| } | ||
|
|
||
| /* | ||
| * @param{N} chtml The HTML node whose indenting is to be adjusted |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indenting -> indentation ?
| const chtml = this.chtml; | ||
| const adaptor = this.adaptor; | ||
| const attributes = this.node.attributes; | ||
| const display = (attributes.get('display') === 'block'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why parentheses?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've always preferred them when assigning a variable the result of a boolean operation. It makes the order of operations explicit. I can remove if you think it is important, but we discussed this once before, and you indicated that it was OK and that we could make it part of our style definition if I wanted.
This PR adds support for
indentalignandindentshift, which control the alignment and indenting of displayed equations. This is handled in themathwrapper, and also in themtablewrapper since tables with labels are in full-width elements, and the alignment of the actual table must be inside the full-width container. Stylesheet CSS handles the alignment, but the shifting requires explicit styles. Because tables rely on theindentalignandindentshiftvalues, they need to be added to the mtable inheritance.This PR also includes fixes for the bubbling up of full-width element, like tables with labels. So if a table is inside another element (e.g.,
mstyle, orsemantics), that won't disrupt the label positioning. This was being done by hand inmrowelements, but that has now been moved to the wrapper super-class.