迁移KE数据问题

dev_hjm
daiao 6 years ago
parent d22455c885
commit 4d534751ea

@ -9,24 +9,8 @@ json.shixuns do
json.partial! 'shixun', locals: {shixuns: @shixuns}
end
s_s = '<p>
作业要求:
</p>
<p>
&nbsp;&nbsp;&nbsp;&nbsp; 1、本作业要求分组完成一个大型程序
</p>
<p>
&nbsp;&nbsp;&nbsp;&nbsp; 2、请按任课教师要求分组
</p>
<p>
&nbsp;&nbsp;&nbsp;&nbsp; 3、每组建议为1-2人
</p>
<p>
&nbsp;&nbsp;&nbsp;&nbsp; 4、每个人都需要完成必要的工作任务并及时提交个人的过程材料
</p>
<p>
&nbsp;&nbsp;&nbsp;&nbsp; 5、上传的单个文件大小不能超过2GB
</p>'
s_s = ''
json.html_contents sanitize(s_s, tags: %w(img a table tr td tbody pre), attributes: %w(src href target style)).gsub(">\n<", "><")
.gsub(/^\n/, "").gsub("    ", "").gsub(/(\n)+/, "<br />").gsub("\t", " ").gsub("\n", "").gsub(" ", " ")
.gsub(/^\n/, "").gsub("    ", "").gsub(/(\n)+/, "<br />").gsub("\t", " ").gsub("\n", "").gsub(" ", " ")
.gsub(/(<br\s?\/?>)+/, "<br />")

@ -5,7 +5,7 @@ class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2]
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(" ", " ")
.gsub("\t", " ").gsub("\n", "").gsub(" ", " ").gsub(/(<br\s?\/?>)+/, "<br />")
end
# 课程讨论区

@ -5,7 +5,7 @@ class SecondMofidyKeContentsForMd < ActiveRecord::Migration[5.2]
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(" ", " ")
.gsub("\t", " ").gsub("\n", "").gsub(" ", " ").gsub(/(<br\s?\/?>)+/, "<br />")
end

@ -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图片的作品

Loading…
Cancel
Save