Line break bug?

As far as I can read on blogs around the internet, this “bug” is not
new:

foo
bar

is translated to: “

foo bar

” and not “

foo
bar

”.

After searching the web for an answer it seems that the missing line-
break functionality is there on purpose.

What is the reason for this?
… and is there a way to “fix” it?

/watson

I totally agree. I fixed it in my own projects by doing a gsub on the
final result.

For me (and all my clients), it’s clear that when they write

my name
45, funny stree
12345 MyPlace

They want the breaks.

The absence of the
is an “inverse” fix. Some form entries used
to automatically wrap lines by adding “\n” (as in most web emails).
The inverse fix made text entries tolerant to this “bug”.

Normal behaviour should definitely be to insert the
tag. When
some input comes malformed, it should be unwrapped before parsing.
This would really make sense.

So, please add the
.

Gaspard

foo
bar

is translated to: “

foo bar

” and not “

foo
bar

”.

some more history: this was brought up last year in the comments on the
ol’ redhanded
(http://redhanded.hobix.com/inspect/superredcloth1160Gems.html), where
someone named fat (responded to by someone named _why, eventually this
all starts to make sense) makes the common-sense argument that redcloth
shouldn’t ignore return marks if people put them in, and people seem to
agree.

this used to be a setting, :hard_breaks, which was taken out sometime, i
forget if i ever read why. jason? it doesn’t seem like it’s a question
of being hard to implement. two breaks =>

, one break =>
,
right?

d

RedCloth 4.0 (a.k.a. SuperRedCloth) atones for the transgressions of
its predecessor and honors hard breaks. We hope to release it soon.
Please help test…

gem install RedCloth --source http://code.whytheluckystiff.net

On 11/04/2008, at 20.14, Jason G. wrote:

RedCloth 4.0 (a.k.a. SuperRedCloth) atones for the transgressions
of its predecessor and honors hard breaks. We hope to release it
soon. Please help test…

gem install RedCloth --source http://code.whytheluckystiff.net

Thanks :slight_smile: - It worked like a charm. Now line-breaks are interpreted
as expected. I’ll keep using this version and of cause report any
bugs I might find.

/watson

On 12/04/2008, at 1.26, Thomas W. Steen wrote:

Thanks :slight_smile: - It worked like a charm. Now line-breaks are
interpreted as expected. I’ll keep using this version and of cause
report any bugs I might find.

Well, it worked on my MacBook Pro running OS X 10.4
But on my staging and production server both running FreeBSD 6.2 I
get the following error:

redcloth_scan.

Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/
gems/RedCloth-3.290 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/RedCloth-3.290/
ext/redcloth_scan/gem_make.out

I don’t know exactly what happends when I install a gem, but it seems
that some C code is compiled for the specific platform. I don’t know
if this bug is related to RedCloth at all, but I’ve been unsuccessful
finding anybody on the web having the same problem. So I hope you
might give me some pointers…

/watson

To flip this bug discussion on its head.

I can understand the desire to conform to the Textile standard, but I
actually find the (old) red cloth’s behaviour far more useful in 99% of
cases.

I very rarely type out addresses, or anything which leads me to care
about the exact positioning of my end of lines, except for code samples,
already handled by bc. On the other hand, what I do end up doing a lot
is storing pages written in textile in VCS systems, so that they can be
worked on easily by collaborators, or just to track them over time. And
for this purpose, being able to type my paragraphs in 80 or 90 character
lines, but have them display as a normal HTML paragraph is far more
valuable. Merges become easier and diffs (Did they add a comma or a
sentence?) are much more comprehensible. It far out outweighs the
inconvenience of having to type
a few times for an address.

Would it be possible to add an option to disable the over enthusiastic
line-breaking?

There is an option. just set the hard_breaks accessor of your
RedCloth object to false.

Jason G. wrote:

There is an option. just set the hard_breaks accessor of your
RedCloth object to false.

Ah, I wasn’t aware of this. Thanks :slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs