Skip to content
Snippets Groups Projects
Commit 6ad2cebe authored by Arnaud Levy's avatar Arnaud Levy
Browse files

clean title

parent 5dceca73
No related branches found
No related tags found
No related merge requests found
class Wordpress class Wordpress
attr_reader :domain attr_reader :domain
def self.clean(html)
def self.clean_string(string)
string = string.gsub(' ', ' ')
string = string.gsub('&', '&')
string = ActionView::Base.full_sanitizer.sanitize string
string
end
def self.clean_html(html)
# Relaxed config : https://github.com/rgrove/sanitize/blob/main/lib/sanitize/config/relaxed.rb # Relaxed config : https://github.com/rgrove/sanitize/blob/main/lib/sanitize/config/relaxed.rb
fragment = Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::RELAXED, fragment = Sanitize.fragment(html, Sanitize::Config.merge(Sanitize::Config::RELAXED,
attributes: Sanitize::Config::RELAXED[:attributes].merge({ attributes: Sanitize::Config::RELAXED[:attributes].merge({
......
# == Schema Information
#
# Table name: communication_website_imported_media
#
# id :uuid not null, primary key
# data :jsonb
# file_url :text
# filename :string
# identifier :string
# mime_type :string
# created_at :datetime
# updated_at :datetime
# university_id :uuid not null
# website_id :uuid not null
#
# Indexes
#
# index_communication_website_imported_media_on_university_id (university_id)
# index_communication_website_imported_media_on_website_id (website_id)
#
# Foreign Keys
#
# fk_rails_... (university_id => universities.id)
# fk_rails_... (website_id => communication_website_imported_websites.id)
#
require "test_helper"
class Communication::Website::Imported::MediumTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
...@@ -57,7 +57,7 @@ class WordpressTest < ActiveSupport::TestCase ...@@ -57,7 +57,7 @@ class WordpressTest < ActiveSupport::TestCase
test "convert &nbsp; in titles" do test "convert &nbsp; in titles" do
assert_equal ' ', assert_equal ' ',
Wordpress.clean_string '&nbsp;' Wordpress.clean_string('&nbsp;')
end end
test "authorize iframes" do test "authorize iframes" do
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment