Skip to content
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

Fix problems with verification and repair of malformed mtables. #779

Merged
merged 4 commits into from
Apr 6, 2022

Conversation

dpvc
Copy link
Member

@dpvc dpvc commented Feb 11, 2022

This PR produces better results for repairing and reporting issues with malformed mtables. There are verification options available that are supposed to control the error messages produced for bad MathML, and one controls whether tables should be repaired silently or produce merror elements to report the problem. The fixMtables option did not work well, as it did not produce proper messages in some cases, and didn't always produce a repaired table.

The fixes here include:

  • Correct interface for return value of error (it was listed as void but returned an error node).
  • Make sure that errors for missing mtr or mtd elements are in a valid mtable, and produce the right output (a colored mtd when used outside an mtr, or a colored mtr when used outside a table, and a colored entry when missing the mtd.
  • Missing mtr and mtd elements are inserted to make a valid table regardless of the verification options (those only control the error reporting).

@dpvc dpvc requested a review from zorkow February 11, 2022 20:11
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.

Lgtm.

I've always been thinking that an alternative to this approach could be to combine all "non-row" elements between rows into a single mtr.

@dpvc dpvc added this to the 3.2.1 milestone Feb 22, 2022
… than multiple mtr), as requested by Volker. Also, add a removeChild() method to the Node class.
@dpvc
Copy link
Member Author

dpvc commented Feb 22, 2022

I've always been thinking that an alternative to this approach could be to combine all "non-row" elements between rows into a single mtr.

That sounds good. I've pushed commits that does that. See if that is more to your liking.

@dpvc dpvc requested a review from zorkow February 22, 2022 20:50
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.

One typo. O/w lgtm.

const isMtd = child.isKind('mtd');
//
// If there is already an mtr for previous children, just remove the child
// otherwise repalce the child with a new mtr
Copy link
Member

Choose a reason for hiding this comment

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

typo

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.

None yet

2 participants