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_breaks
option 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*
paragraph 2
_TEXTILE
wiki(textile).
should_not have_selector("br")
end
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>
paragraph 2</p></body></html>
./spec/eee_helpers_spec.rb:72:
no_breaks
accessor in the wiki
helper:def wiki(original, convert_textile=true)That makes the example pass and fixes the display issues:
text = (original || '').dup
#...
if convert_textile
textile = RedCloth.new(text)
textile.hard_breaks = false
textile.to_html
else
text
end
end
In addition to resolving my
:hard_breaks
RedCloth
woes, 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.
No comments:
Post a Comment