From 8384a8a32ad1fadb2fa6c5ec4fe71312cffb9768 Mon Sep 17 00:00:00 2001 From: f Date: Mon, 25 Mar 2024 14:29:05 -0300 Subject: [PATCH] feat: darle formato al html guardado #14417 --- Gemfile | 1 + Gemfile.lock | 2 ++ app/models/metadata_content.rb | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index 466ec079..995cb849 100644 --- a/Gemfile +++ b/Gemfile @@ -76,6 +76,7 @@ gem 'webpacker' gem 'yaml_db', git: 'https://0xacab.org/sutty/yaml_db.git' gem 'kaminari' gem 'device_detector' +gem 'htmlbeautifier' # database gem 'hairtrigger' diff --git a/Gemfile.lock b/Gemfile.lock index 78563c84..862880b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -255,6 +255,7 @@ GEM heapy (0.2.0) thor hiredis (0.6.3-x86_64-linux-musl) + htmlbeautifier (1.4.2) http_parser.rb (0.8.0-x86_64-linux-musl) httparty (0.21.0) mini_mime (>= 1.0.0) @@ -616,6 +617,7 @@ DEPENDENCIES haml-lint hamlit-rails hiredis + htmlbeautifier httparty icalendar image_processing diff --git a/app/models/metadata_content.rb b/app/models/metadata_content.rb index 761518e8..444ee2fe 100644 --- a/app/models/metadata_content.rb +++ b/app/models/metadata_content.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require 'htmlbeautifier' + # Se encarga del contenido del artículo y quizás otros campos que # requieran texto largo. class MetadataContent < MetadataTemplate @@ -86,7 +88,7 @@ class MetadataContent < MetadataTemplate end end - html.to_s.html_safe + HtmlBeautifier.beautify(html.to_s).html_safe end # Limpia estilos en base a una lista de permitidos