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

Correct location of alt-text content #9134

Merged
merged 8 commits into from
Oct 17, 2023
Merged

Correct location of alt-text content #9134

merged 8 commits into from
Oct 17, 2023

Conversation

kamoe
Copy link
Contributor

@kamoe kamoe commented Oct 13, 2023

Fix JATS reader erroneously attempting to fetch alt-text content from non-existent @alt-text attribute, to optional child element

@@ -138,18 +138,16 @@ trimNl = T.dropAround (== '\n')

-- function that is used by both graphic (in parseBlock)
-- and inline-graphic (in parseInline)
getGraphic :: PandocMonad m
=> Maybe (Inlines, Text) -> Element -> JATS m Inlines
Copy link
Contributor Author

@kamoe kamoe Oct 13, 2023

Choose a reason for hiding this comment

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

Noticed this function was only ever called with Nothing as first argument, which means it does not need it. Got rid of this argument and all corresponding logic.

let altText = case filterElement (named "alt-text") e of
Just alt -> textContent alt
Nothing -> mempty
(ident, title, altText') = (atVal "id", atVal "title", text altText)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

third argument is actually capturing alt-text, not caption, renamed as such

Just (capt', i) -> (i, "fig:" <> atVal "title", capt')
Nothing -> (atVal "id", atVal "title",
text (atVal "alt-text"))
let altText = case filterElement (named "alt-text") e of
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is where we fetch content from a child, rather than an argument

@jgm jgm merged commit fa3513b into jgm:main Oct 17, 2023
9 of 12 checks passed
@jgm
Copy link
Owner

jgm commented Oct 17, 2023

great, thanks!

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