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

Miscellaneous refactors #10457

Merged
merged 7 commits into from
Dec 15, 2024
Merged

Miscellaneous refactors #10457

merged 7 commits into from
Dec 15, 2024

Conversation

josephcsible
Copy link
Contributor

No description provided.

This is more efficient than the existing one.
"all f []" is always true, so "null xs || all f xs" can be simplified
to just "all f xs".
Copy link
Owner

@jgm jgm left a comment

Choose a reason for hiding this comment

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

Looks good except for the two things noted!

@@ -82,7 +82,7 @@ pandocToANSI opts (Pandoc meta blocks) = do
body <- blockListToANSI opts blocks'
notes <- gets $ reverse . stNotes
let notemark x = D.literal (tshow (x :: Int) <> ".") <+> D.space
let marks = take (length notes) $ map notemark [1..]
let marks = map notemark [1..length notes + 1]
Copy link
Owner

Choose a reason for hiding this comment

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

Is the + 1 here right? I don't see why. Previously marks was a list of the same length as notes. With this change it will be 1 longer than notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whoops, you're right. Fixed.

let isDisplay = case lookup "display" attr of
Just "block" -> True
_ -> False
let possiblyDisplayMath = case lookup "display" attr of
Copy link
Owner

Choose a reason for hiding this comment

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

Instead of possiblyDisplayMath, I think constructor would be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Instead of storing isDisplay and then always choosing displayMath or math
based on that, just store displayMath or math directly.
@jgm jgm merged commit 58cc5cc into jgm:main Dec 15, 2024
9 of 12 checks passed
@jgm
Copy link
Owner

jgm commented Dec 15, 2024

thanks!

@josephcsible josephcsible deleted the refactors branch December 15, 2024 02:00
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