El Dorado

A full-stack community web application written in Ruby/Rails
Fri, 23 May 2008, 2:48pm bbcode lists »
irkenInvader
Member
Zim
Registered: May, 2008
Last visit: Wed, 04 Jun 2008
Posts: 85

Ok.

simple_format is definitely the culprit.

It goes through the post and replaces '\n' or '\r\n' with '\n<br />'

Here's the source of simple_format that does the work:
[code]
content_tag 'p', text.to_s.
gsub(/\r\n?/, "\n"). # \r\n and \r -> \n
gsub(/\n\n+/, "</p>\n\n<p>"). # 2+ newline -> paragraph
gsub(/([^\n]\n)(?=[^\n])/, '\1<br />') # 1 newline -> br
[/code]

So, the real problem is that [code] blocks (and my [list] blocks) need to be "prettified". The real question is should I try to "prettify" them in bbcodeizer (essentially, before simple_format gets a hold on the string), or in bb (after simple_format).

i'll try both and go with the more elegant solution.

[code]TEST TEST TEST[/code]


Zim wrote:

Invader’s blood marches through my veins like giant, radioactive rubber pants! The pants command me! Do not ignore my veins!

Offline