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

Add DokuWiki table alignment for #5202 #7908

Merged
merged 2 commits into from
Feb 11, 2022
Merged

Conversation

damon-sava-stanley
Copy link
Contributor

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.

-- 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
Copy link
Owner

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?

Comment on lines 516 to 517
let left = (==2) . length . filter (== B.space) . take 2 $ cellInline
let right = (==2) . length . filter (== B.space) . take 2 . reverse $ cellInline
Copy link
Owner

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?

@jgm
Copy link
Owner

jgm commented Feb 11, 2022

Looks good, thanks! I made a couple minor comments in the code.

damon-sava-stanley added a commit to damon-sava-stanley/pandoc that referenced this pull request Feb 11, 2022
Don't reinvent the wheel of `isPrefixOf` and pull out some spooky
`head`s.
damon-sava-stanley added a commit to damon-sava-stanley/pandoc that referenced this pull request Feb 11, 2022
Don't reinvent the wheel of `isPrefixOf` and pull out some spooky
`head`s.
damon-sava-stanley pushed a commit to damon-sava-stanley/pandoc that referenced this pull request Feb 11, 2022
with an error, if a resource can't be found.
Closes jgm#7904.

Make improvements for jgm#7908

Don't reinvent the wheel of `isPrefixOf` and pull out some spooky
`head`s.
@damon-sava-stanley damon-sava-stanley force-pushed the master branch 2 times, most recently from 84eca20 to b7db72c Compare February 11, 2022 16:39
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.
@damon-sava-stanley
Copy link
Contributor Author

Thanks for the suggestions! I've integrated them. (Apologies for the git churn above, it's been a minute on my part.)

@jgm jgm merged commit d3716ea into jgm:master Feb 11, 2022
@jgm
Copy link
Owner

jgm commented Feb 11, 2022

Excellent, thanks for this!

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