Forum: Redcloth Line break bug?

Posted by Thomas Watson Steen (Guest)
on 2008-04-11 12:45
(Received via mailing list)
As far as I can read on blogs around the internet, this "bug" is not
new:

foo
bar

is translated to: "<p>foo bar</p>" and not "<p>foo<br />bar</p>".

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
Posted by Gaspard Bucher (gazoduc)
on 2008-04-11 14:29
(Received via mailing list)
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 <br/> 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 <br/> tag. When
some input comes malformed, it should be unwrapped before parsing.
This would really make sense.

So, please add the <br/>.

Gaspard
Posted by David Reese (Guest)
on 2008-04-11 17:31
(Received via mailing list)
> foo
> bar
>
> is translated to: "<p>foo bar</p>" and not "<p>foo<br />bar</p>".

some more history:  this was brought up last year in the comments on the
ol' redhanded
(http://redhanded.hobix.com/inspect/superredcloth11...), 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 => <p>, one break => <br />, 
right?

d
Posted by Jason Garber (Guest)
on 2008-04-11 20:15
(Received via mailing list)
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
Posted by Thomas Watson Steen (Guest)
on 2008-04-12 01:50
(Received via mailing list)
On 11/04/2008, at 20.14, Jason Garber 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 :)  - 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
Posted by Thomas Watson Steen (Guest)
on 2008-04-12 11:37
(Received via mailing list)
On 12/04/2008, at 1.26, Thomas Watson Steen wrote:
> Thanks :)  - 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
Posted by Jonathan Stott (namelessjon)
on 2008-08-02 12:58
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 <br /> a few times for an address.

Would it be possible to add an option to disable the over enthusiastic 
line-breaking?
Posted by Jason Garber (jgarber)
on 2008-08-04 15:41
(Received via mailing list)
There is an option.  just set the hard_breaks accessor of your
RedCloth object to false.
Posted by Jonathan Stott (namelessjon)
on 2008-08-06 09:51
Jason Garber 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 :)
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.