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

🦶🎵 Implement footnotes in myst-to-tex #256

Merged
merged 2 commits into from
Feb 23, 2023
Merged

Conversation

fwkoch
Copy link
Collaborator

@fwkoch fwkoch commented Feb 23, 2023

No description provided.

@@ -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[];
Copy link
Collaborator Author

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...

Copy link
Collaborator

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];
Copy link
Collaborator Author

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.

@rowanc1
Copy link
Collaborator

rowanc1 commented Feb 23, 2023

Looks good! Looking forward to implementing this properly in JATS, but will take another pass on the XML side. 🔜

@rowanc1 rowanc1 changed the title 🦶 Implement footnotes in myst-to-tex and myst-to-jats 🦶🎵 Implement footnotes in myst-to-tex Feb 23, 2023
@rowanc1 rowanc1 merged commit 0859b29 into main Feb 23, 2023
@rowanc1 rowanc1 deleted the feat/latex-footnotes branch February 23, 2023 21:57
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.

2 participants