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

tag.js: in "text equation" there might not be target elements #429

Closed
pkra opened this issue Sep 6, 2023 · 5 comments
Closed

tag.js: in "text equation" there might not be target elements #429

pkra opened this issue Sep 6, 2023 · 5 comments
Assignees
Labels
Milestone

Comments

@pkra
Copy link
Member

pkra commented Sep 6, 2023

In

https://github.com/AmerMathSoc/ams-xml-to-html/blob/4da69c39d51d15cad31a7becdaf39f59776b5bcc/lib/elements/tag.js#L24

the comment says to assume that each tag has a wrapping target.

However, mcom3734 actually does not.

[Surprisingly, this has not caused issues because instead, the parent is the disp-formula which has an ID and we do not preserve those IDs in HTML.]

@pkra pkra added the bug label Sep 6, 2023
@pkra pkra added this to the 2023 milestone Sep 6, 2023
@pkra pkra self-assigned this Sep 6, 2023
@pkra
Copy link
Member Author

pkra commented Sep 6, 2023

A quick search showed no other unexpected parents of tag elements -- just tex-math, target, and exactly once disp-formula (for mcom3734's text equation without target).

@pkra pkra modified the milestones: 2023, 2024 Jan 15, 2024
@pkra pkra modified the milestones: 2024, 2025 Jan 7, 2025
@pkra
Copy link
Member Author

pkra commented Jan 16, 2025

It seems more transparent to avoid unwrapping target

// NOTE: inside a "text equation" we pass it through; the tag child will pick up the ID.
if (xmlnode.parentNode.tagName === 'disp-formula' && xmlnode.parentNode.getAttribute('content-type') === 'text') {
this.passThrough(htmlParentNode, xmlnode);
return;

Then its output would naturally become the target (duh!) and tag would not need to add an ID it never had.

However, then we need to prepend target (or make a breaking change and let downstream re-arrange -- which seems unnecessary since we have tags on the left everywhere).

@pkra
Copy link
Member Author

pkra commented Jan 16, 2025

On a related note, I've filed AmerMathSoc/texml#231 to see if we can move the parens handling upstream.

@pkra
Copy link
Member Author

pkra commented Jan 16, 2025

However, then we need to prepend target (or make a breaking change and let downstream re-arrange -- which seems unnecessary since we have tags on the left everywhere).

Random thought: a tag without target would also need to be prepended. If we always prepend a tag, could it cause trouble when there's a target?

@pkra
Copy link
Member Author

pkra commented Jan 16, 2025

I've filed AmerMathSoc/texml#232 in which case we get to simplify this in the future.

@pkra pkra closed this as completed in d7244f6 Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant