diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 30b2e7a21..a36f4b183 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1198,6 +1198,17 @@ module ApplicationHelper html_safe end + def wiki_simple_format_without_paragraph(text) + text.to_s. + gsub(/\r\n?/, "\n"). # \r\n and \r -> \n + gsub(/\n\n+/, "

"). # 2+ newline -> 2 br + gsub(/([^\n]\n)(?=[^\n])/, '\1
'). # 1 newline -> br + gsub("&nbsp", " "). #gsub(/<\/?.*?>/,""). + gsub(/<\/?.*?>/, ""). + gsub(""", "'"). + html_safe + end + def lang_options_for_select(blank=true) { 'Chinese简体中文 '=> 'zh', :English => :en} end diff --git a/app/views/wiki/diff.html.erb b/app/views/wiki/diff.html.erb index adeaa7cab..6af69db68 100644 --- a/app/views/wiki/diff.html.erb +++ b/app/views/wiki/diff.html.erb @@ -29,5 +29,5 @@

- <%= simple_format_without_paragraph @diff.to_html %> + <%= wiki_simple_format_without_paragraph @diff.to_html %>