mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-24 12:26:21 +00:00
28 lines
592 B
Ruby
28 lines
592 B
Ruby
# frozen_string_literal: true
|
|
|
|
# Un campo de texto
|
|
class MetadataString < MetadataTemplate
|
|
include Metadata::IndexableConcern
|
|
|
|
# Una string vacía
|
|
#
|
|
# @return [String]
|
|
def default_value
|
|
super || ''
|
|
end
|
|
|
|
private
|
|
|
|
# No se permite HTML en las strings
|
|
#
|
|
# @todo Escapar https://0xacab.org/sutty/sutty/-/issues/4101
|
|
# @param :string [String]
|
|
# @return [String]
|
|
def sanitize(string)
|
|
return '' if string.blank?
|
|
|
|
sanitizer.sanitize(string.strip.unicode_normalize,
|
|
tags: [],
|
|
attributes: []).strip.html_safe
|
|
end
|
|
end
|