#2001 项目--工具集中wiki-“查看差别”中有html标签
This commit is contained in:
parent
04e5aee3c2
commit
4b831c9e65
|
@ -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+/, "<br /><br />"). # 2+ newline -> 2 br
|
||||
gsub(/([^\n]\n)(?=[^\n])/, '\1<br />'). # 1 newline -> br
|
||||
gsub("&nbsp", " "). #gsub(/<\/?.*?>/,"").
|
||||
gsub(/<\/?.*?>/, "").
|
||||
gsub(""", "'").
|
||||
html_safe
|
||||
end
|
||||
|
||||
def lang_options_for_select(blank=true)
|
||||
{ 'Chinese简体中文 '=> 'zh', :English => :en}
|
||||
end
|
||||
|
|
|
@ -29,5 +29,5 @@
|
|||
</p>
|
||||
|
||||
<div class="text-diff" style="word-break: break-all;word-wrap: break-word;">
|
||||
<%= simple_format_without_paragraph @diff.to_html %>
|
||||
<%= wiki_simple_format_without_paragraph @diff.to_html %>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue