mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-01-06 15:40:31 +08:00
18 lines
396 B
Ruby
18 lines
396 B
Ruby
module InputSanitizeHelper
|
|
def sanitize_input(text)
|
|
ActionController::Base.helpers.sanitize(
|
|
text,
|
|
tags: Constants::WHITELISTED_TAGS,
|
|
attributes: Constants::WHITELISTED_ATTRIBUTES
|
|
)
|
|
end
|
|
|
|
def escape_input(text)
|
|
ERB::Util.html_escape(text)
|
|
end
|
|
|
|
def custom_auto_link(text, args)
|
|
args[:sanitize] = false
|
|
sanitize_input(auto_link(text, args))
|
|
end
|
|
end
|