Aw, for crying out loud.
I again find myself clicking out the beta site only to find a little problem. Today's problem are weird line breaks:
Grrr... Every time I use
RedCloth, I get the line breaks (or something) wrong.
Digging through the code, I have to give the maintainers credit—although the
:no_breaksoption is apparently deprecated, there is still an accessor for this option. But first, a (RSpec) test:
it "should not have line breaks in paragraphs" doAs expected, that fails:
textile = <<_TEXTILE
paragraph 1 *bold text*
1)To get that to pass, I use the
'wiki should not have line breaks in paragraphs' FAILED
expected following output to omit a <br/>:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><body><p>paragraph 1 <strong>bold text</strong><br>
no_breaksaccessor in the
def wiki(original, convert_textile=true)That makes the example pass and fixes the display issues:
text = (original || '').dup
textile = RedCloth.new(text)
textile.hard_breaks = false
In addition to resolving my
RedClothwoes, I also spend a little time to get a link to a Google query working:
We are not trying to lock users into our site—it's just a family cookbook, so we like to include those links.
Up tomorrow, I have some Amazon associate work to do.