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

Preserving empty lines in free text fields #29

Closed
jlwoodwa opened this issue Apr 1, 2021 · 5 comments · Fixed by #86
Closed

Preserving empty lines in free text fields #29

jlwoodwa opened this issue Apr 1, 2021 · 5 comments · Fixed by #86
Labels
help wanted Extra attention is needed

Comments

@jlwoodwa
Copy link

jlwoodwa commented Apr 1, 2021

cabal-fmt strips empty lines from all fields. However, with the new free text rules (haskell/cabal#5981), empty lines seem to be the only way to break paragraphs in the description field, etc. (Previously, a line containing a single period would do the trick, and cabal-fmt preserved this.)

Can cabal-fmt be changed to preserve empty lines in free text fields?

@phadej phadej added the help wanted Extra attention is needed label Apr 1, 2021
@phadej
Copy link
Owner

phadej commented Apr 1, 2021

Yes, that would be good to fix.

I'm not sure where (and why) the empty lines are stripped.

@shlevy
Copy link

shlevy commented Jan 13, 2024

@phadej Would this be a hard fix? Can you point to where to look?

@phadej
Copy link
Owner

phadej commented Jan 14, 2024

@shlevy I suspect it's an issue in Cabal-syntax. See #86

The traceShowId prints `"First Paragraph\nSecond Paragraph", i.e. there is a missing line feed already.

https://github.com/haskell/cabal/blob/f01e000b92ddf8cf04a175228e0758fafb732a4d/Cabal-syntax/src/Distribution/FieldGrammar/Parsec.hs#L404 is a suspect. It makes the indentation be right, but it forgets to insert empty lines when the are between input FieldLines (i.e. positionRow differ by two or more).

@phadej
Copy link
Owner

phadej commented Jan 14, 2024

Actually no. The issue is in cabal-fmt (but Cabal-syntax does not have a bug)

@phadej
Copy link
Owner

phadej commented Jan 14, 2024

The #86 seems to work, I'll cleanup it later this month

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants