-
-
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
Add DokuWiki table alignment for #5202 #7908
Conversation
src/Text/Pandoc/Readers/DokuWiki.hs
Outdated
-- choice of how to reconcile potentially different alignments in the row. | ||
-- Here we end up assuming that the alignment of the header / first row is | ||
-- what the user wants to apply to the whole thing. | ||
let attrs = map (\(a, _) -> (a, ColWidthDefault)) . head $ rows |
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.
head
makes me nervous because it's partial, even though here many1
guarantees a nonempty list.
Could we use headMay
from Safe, or a pattern match, or some other non-partial function?
src/Text/Pandoc/Readers/DokuWiki.hs
Outdated
let left = (==2) . length . filter (== B.space) . take 2 $ cellInline | ||
let right = (==2) . length . filter (== B.space) . take 2 . reverse $ cellInline |
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.
Maybe more straightforward: [B.space, B.space]
isPrefixOf cellInline
and similarly for right with isSuffixOf
?
Looks good, thanks! I made a couple minor comments in the code. |
Don't reinvent the wheel of `isPrefixOf` and pull out some spooky `head`s.
Don't reinvent the wheel of `isPrefixOf` and pull out some spooky `head`s.
84eca20
to
b7db72c
Compare
Within each cell, determine the cell alignment as per https://www.dokuwiki.org/wiki:syntax#tables. The current approach, as per the issue treats the first row's alignment as determining that of the entire column. Given this, it wastes some work in determining an alignment for every cell.
Don't reinvent the wheel of `isPrefixOf` and pull out some spooky `head`s.
b7db72c
to
01fce71
Compare
Thanks for the suggestions! I've integrated them. (Apologies for the git churn above, it's been a minute on my part.) |
Excellent, thanks for this! |
Within each cell, determine the cell alignment as per
https://www.dokuwiki.org/wiki:syntax#tables. The current approach, as
per the issue treats the first row's alignment as determining
that of the entire column. Given this, it wastes some work in
determining an alignment for every cell.