Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Package description parser interprets curly braces in the description field #774

Closed
bos opened this Issue May 24, 2012 · 2 comments

Comments

Projects

todo in Parsec Parser

5 participants
Contributor

bos commented May 24, 2012

(Imported from Trac #784, reported by guest on 2010-12-29)

If you have a description like this:

description: Here is some C code:
             .
             > for(i = 0; i < 100; i++){
             >   printf("%d\n",i);
             > }
             .
Cabal will strip out the brackets. You can use @..@ syntax with &#123; and &#125; except that then the whitespace is off in your code block and you have to escape any symbols that haddock knows. Putting a blackslash () in front the braces does not help.

The above example works fine in plain haddock leading me the conclusion that cabal is eating the braces.

Contributor

manzyuk commented May 3, 2013

Braces play a special role in .cabal files as they delimit sections and branches of conditionals. They are stripped by the parser as soon as the boundaries of sections / branches have been figured out. One could augment the tokenizer so that the lines beginning with '>' are left intact. I tried that and this fixes the above example.

Is it a good / right way to fix this issue? Am I overlooking anything?

This change doesn't fix stripping of the curly braces in code blocks delimited by @...@, which haddock seems to handle fine. I suppose this could also be fixed by changing the tokenizer.

Member

23Skidoo commented May 3, 2013

@manzyuk

One could augment the tokenizer so that the lines beginning with '>' are left intact. I tried that and this fixes the above example.
Is it a good / right way to fix this issue? Am I overlooking anything?

Please submit a pull request, and we'll take a look at it.

@ttuegel ttuegel added this to the _|_ milestone Apr 23, 2015

@ttuegel ttuegel changed the title from Cabal strips out { and } in literate code blocks of the description field to Package description parser interprets curly braces in the description field Apr 23, 2015

@phadej phadej added a commit to phadej/cabal that referenced this issue Aug 17, 2017

@phadej phadej Add regression test. Resolves #774 d077545

@phadej phadej added a commit to phadej/cabal that referenced this issue Aug 17, 2017

@phadej phadej Add regression test. Resolves #774 d0569c5

@phadej phadej closed this in c34debf Aug 18, 2017

@phadej phadej added a commit that referenced this issue Aug 18, 2017

@phadej phadej Merge pull request #4707 from phadej/issue-744
Add regression test. Resolves #774
bbdff75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment