|
|
|
@ -4,8 +4,8 @@ class ThirdModifyKeForStudentWork < 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(" ", "").gsub(/(\n)+/, "<br />")
|
|
|
|
|
.gsub("\t", " ").gsub("\n", "").gsub(" ", " ")
|
|
|
|
|
s_contents.gsub(">\n<", "><").gsub(/^\n/, "").gsub(" ", "").gsub(/(\n)+/, "<br />")
|
|
|
|
|
.gsub("\t", " ").gsub("\n", "").gsub(" ", " ").gsub(/(<br\s?\/?>)+/, "<br />")
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
# 学生的作品 过滤掉一些描述的ke图片的作品
|
|
|
|
|