Skip to content

Conversation

@dpvc
Copy link
Member

@dpvc dpvc commented May 16, 2018

This PR adds support for indentalign and indentshift, which control the alignment and indenting of displayed equations. This is handled in the math wrapper, and also in the mtable wrapper 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 the indentalign and indentshift values, 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, or semantics), that won't disrupt the label positioning. This was being done by hand in mrowelements, but that has now been moved to the wrapper super-class.

Copy link
Member

@zorkow zorkow left a 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']) {
Copy link
Member

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,

*/
protected getAlignShift() {
let {indentalign, indentshift, indentalignfirst, indentshiftfirst} =
this.node.attributes.getList('indentalign', 'indentshift',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment.

}

/*
* @param{N} chtml The HTML node whose indenting is to be adjusted
Copy link
Member

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');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why parentheses?

Copy link
Member Author

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.

@dpvc dpvc merged commit d178eb5 into fix-label-positions Aug 9, 2018
@dpvc dpvc deleted the align-shift branch August 9, 2018 21:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants