-
Notifications
You must be signed in to change notification settings - Fork 61
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
🦶🎵 Implement footnotes in myst-to-tex #256
Conversation
packages/myst-to-jats/src/index.ts
Outdated
@@ -393,6 +408,10 @@ const plugin: Plugin<[Options?], Root, VFile> = function (opts) { | |||
const tree = copyNode(node) as any; | |||
basicTransformations(tree, file); | |||
const state = new JatsSerializer(file, opts ?? { handlers }); | |||
const footnotes = selectAll('footnoteDefinition', tree) as FootnoteDefinition[]; |
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.
We handle footnoteDefinition
nodes left in the tree here. This is nice and what we should move to everywhere...
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.
Nice, looking forward to that.
@@ -247,20 +248,30 @@ const handlers: Record<string, Handler> = { | |||
include(node, state) { | |||
state.renderChildren(node, true); | |||
}, | |||
footnoteReference(node, state) { | |||
if (!node.identifier) return; | |||
const footnote = state.references.footnotes?.[node.identifier]; |
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.
Here, we assume footnoteDefinition
nodes have been pulled off the tree and are passed in separately. This is how myst-cli
currently operates but is not super nice. We should move towards just leaving the footnote nodes in the tree rather than passing around a separate references
object.
Looks good! Looking forward to implementing this properly in JATS, but will take another pass on the XML side. 🔜 |
No description provided.