-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Miscellaneous refactors #10457
Conversation
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".
f6a4a3a
to
773bc54
Compare
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.
Looks good except for the two things noted!
src/Text/Pandoc/Writers/ANSI.hs
Outdated
@@ -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] |
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.
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
.
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.
Whoops, you're right. Fixed.
src/Text/Pandoc/Readers/HTML.hs
Outdated
let isDisplay = case lookup "display" attr of | ||
Just "block" -> True | ||
_ -> False | ||
let possiblyDisplayMath = case lookup "display" attr of |
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.
Instead of possiblyDisplayMath
, I think constructor
would be better.
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.
Done.
Instead of storing isDisplay and then always choosing displayMath or math based on that, just store displayMath or math directly.
773bc54
to
78e359d
Compare
thanks! |
No description provided.