cram icon indicating copy to clipboard operation
cram copied to clipboard

Don't require whitespace on blank lines

Open sourcefrog opened this issue 8 years ago • 4 comments

cram sometimes requires trailing whitespace, which causes unfortunate conflicts with trees or editors set up to strip them.

The main case I notice is blank spaces occurring in the middle of output blocks. cram wants them to have ^ $ so that they're indented to the same point. It seems like that could be ignored without much loss of sensitivity.

sourcefrog avatar Aug 05 '15 04:08 sourcefrog

I could probably send you a patch for this if it's acceptable in principle.

sourcefrog avatar Aug 05 '15 20:08 sourcefrog

:+1:

pnathan avatar Oct 27 '15 03:10 pnathan

wouldn't that create an ambiguity?

roman-neuhauser avatar May 29 '17 10:05 roman-neuhauser

I think not, but there might be some difficult cases.

This command prints _n_ blank lines:

  $ print_blank_lines 4





Pretty neat!

I think you could potentially fix that by saying the document is composed of paragraphs separated by single blank lines, and each paragraph is an example if the nonblank lines all have >=2 spaces. Then, the middle paragraph of this example contains 4 blank lines at the end.

I tried a patch for this years ago but found the parser code hard to change.

sourcefrog avatar May 31 '17 16:05 sourcefrog