diff --git a/app/lib/core_extensions/string/remove_diacritics.rb b/app/lib/core_extensions/string/remove_diacritics.rb new file mode 100644 index 00000000..679db13d --- /dev/null +++ b/app/lib/core_extensions/string/remove_diacritics.rb @@ -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 diff --git a/config/initializers/core_extensions.rb b/config/initializers/core_extensions.rb index 7d1eab9e..6861da45 100644 --- a/config/initializers/core_extensions.rb +++ b/config/initializers/core_extensions.rb @@ -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