dev_hjm
daiao 6 years ago
parent 6fb4dc7ad5
commit 7707045773

@ -5,7 +5,7 @@ class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2]
return content if content.blank? return content if content.blank?
s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style)) s_contents = sanitize(content, tags: %w(img a span table td tr tbody pre), attributes: %w(src href target style))
s_contents.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", "").gsub(/(\n)+/, "<br />") s_contents.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", "").gsub(/(\n)+/, "<br />")
.gsub("\t", "").gsub("\n", "").gsub(" ", "&nbsp;").gsub(/(<br\s?\/?>)+/, "<br />") .gsub("\t", "").gsub("\n", "").gsub(" ", "&nbsp;&nbsp;&nbsp;&nbsp;").gsub(/(<br\s?\/?>)+/, "<br />")
end end
# #
# # 课程讨论区 # # 课程讨论区
Loading…
Cancel
Save