2019-08-06 17:54:17 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Un campo de texto
|
|
|
|
class MetadataString < MetadataTemplate
|
2023-10-06 13:53:19 +00:00
|
|
|
include Metadata::IndexableConcern
|
|
|
|
|
2019-08-06 17:54:17 +00:00
|
|
|
# Una string vacía
|
2023-10-06 13:53:19 +00:00
|
|
|
#
|
|
|
|
# @return [String]
|
2019-08-06 17:54:17 +00:00
|
|
|
def default_value
|
2020-11-11 18:29:12 +00:00
|
|
|
super || ''
|
2019-08-06 17:54:17 +00:00
|
|
|
end
|
2020-07-02 14:26:00 +00:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
# No se permite HTML en las strings
|
2023-10-06 13:53:19 +00:00
|
|
|
#
|
|
|
|
# @todo Escapar https://0xacab.org/sutty/sutty/-/issues/4101
|
|
|
|
# @param :string [String]
|
|
|
|
# @return [String]
|
2020-07-02 14:26:00 +00:00
|
|
|
def sanitize(string)
|
|
|
|
return '' if string.blank?
|
|
|
|
|
2022-04-28 13:34:57 +00:00
|
|
|
sanitizer.sanitize(string.strip.unicode_normalize,
|
2020-07-02 14:26:00 +00:00
|
|
|
tags: [],
|
2020-11-16 16:17:23 +00:00
|
|
|
attributes: []).strip.html_safe
|
2020-07-02 14:26:00 +00:00
|
|
|
end
|
2019-08-06 17:54:17 +00:00
|
|
|
end
|