@@ -15,6 +15,14 | |||
|
15 | 15 | # along with this program; if not, write to the Free Software |
|
16 | 16 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|
17 | 17 | |
|
18 | class RedCloth | |
|
19 | # Patch for RedCloth. Fixed in RedCloth r128 but _why hasn't released it yet. | |
|
20 | # <a href="http://code.whytheluckystiff.net/redcloth/changeset/128">http://code.whytheluckystiff.net/redcloth/changeset/128</a> | |
|
21 | def hard_break( text ) | |
|
22 | text.gsub!( /(.)\n(?!\n|\Z| *([#*=]+(\s|$)|[{|]))/, "\\1<br />" ) if hard_breaks | |
|
23 | end | |
|
24 | end | |
|
25 | ||
|
18 | 26 | module ApplicationHelper |
|
19 | 27 | |
|
20 | 28 | # Return current logged in user or nil |
@@ -139,7 +147,7 module ApplicationHelper | |||
|
139 | 147 | |
|
140 | 148 | # finally textilize text |
|
141 | 149 | @do_textilize ||= (Setting.text_formatting == 'textile') && (ActionView::Helpers::TextHelper.method_defined? "textilize") |
|
142 | text = @do_textilize ? auto_link(RedCloth.new(text).to_html) : simple_format(auto_link(h(text))) | |
|
150 | text = @do_textilize ? auto_link(RedCloth.new(text, [:hard_breaks]).to_html) : simple_format(auto_link(h(text))) | |
|
143 | 151 | end |
|
144 | 152 | |
|
145 | 153 | def error_messages_for(object_name, options = {}) |
General Comments 0
You need to be logged in to leave comments.
Login now