mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-22 09:26:21 +00:00
feat: eliminar tildes de una string, sin transliterar
usamos esto porque es más rápido y podemos tener un proceso similar en js sin implementar transliteración
This commit is contained in:
parent
c75deaf030
commit
8fe964686b
2 changed files with 13 additions and 0 deletions
12
app/lib/core_extensions/string/remove_diacritics.rb
Normal file
12
app/lib/core_extensions/string/remove_diacritics.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module CoreExtensions
|
||||
module String
|
||||
# Elimina tildes
|
||||
module RemoveDiacritics
|
||||
def remove_diacritics
|
||||
unicode_normalize(:nfd).gsub(/[^\x00-\x7F]/, '')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,6 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
String.include CoreExtensions::String::StripTags
|
||||
String.include CoreExtensions::String::RemoveDiacritics
|
||||
Jekyll::Document.include CoreExtensions::Jekyll::Document::Path
|
||||
Jekyll::DataReader.include Jekyll::Readers::DataReaderDecorator
|
||||
|
||||
|
|
Loading…
Reference in a new issue