试卷KE迁移

dev_hjm
daiao 6 years ago
parent fe3572da12
commit 16bcd83aba

@ -4,8 +4,8 @@ class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2]
def ke_transform_to_md content
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.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", "&nbsp;").gsub(/(\n)+/, "<br />")
.gsub("\t", "&nbsp;&nbsp;&nbsp;&nbsp;").gsub("\n", "").gsub(" ", "&nbsp;").gsub(/(<br\s?\/?>)+/, "<br />")
s_contents.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", "").gsub(/(\n)+/, "<br />")
.gsub("\t", "").gsub("\n", "").gsub(" ", "&nbsp;").gsub(/(<br\s?\/?>)+/, "<br />")
end
#
# # 课程讨论区

Loading…
Cancel
Save