diff --git a/slices/main/decorators/posts/decorator.rb b/slices/main/decorators/posts/decorator.rb index 6dd2ecd..a7a0cdc 100644 --- a/slices/main/decorators/posts/decorator.rb +++ b/slices/main/decorators/posts/decorator.rb @@ -117,13 +117,12 @@ module Main html_text = wrap_anchors_in_object_tags(replace_urls_with_anchors(content)) res = Sanitize.fragment(html_text, elements: ["img", "p", "object", "a"], - attributes: {"img" => ["alt", "src", "title"], "a" => ["href"]}) + attributes: {"img" => ["alt", "src", "title"], "a" => ["href", "class"]}) res.gsub(prefix_emoji[0], "") if prefix_emoji end def raw_content - res = Sanitize.fragment(content) - res.gsub(prefix_emoji[0], "") if prefix_emoji + rendered_content end def excerpt @@ -188,7 +187,8 @@ module Main url_regex = %r{(?]*(|/>))} text.gsub(url_regex) do |url| - %(#{url}) + clean_url = Sanitize.fragment(url).gsub(/\s/, "") + %(#{clean_url}) end end diff --git a/slices/main/decorators/statuses/decorator.rb b/slices/main/decorators/statuses/decorator.rb index 747cf84..64b9d08 100644 --- a/slices/main/decorators/statuses/decorator.rb +++ b/slices/main/decorators/statuses/decorator.rb @@ -10,13 +10,11 @@ module Main module Decorators module Statuses class Decorator < Main::Decorators::Posts::Decorator - REGEXP = URI::DEFAULT_PARSER.make_regexp - def raw_content html_text = wrap_anchors_in_object_tags(replace_urls_with_anchors(content)) res = Sanitize.fragment(html_text, elements: ["img", "p", "object", "a"], - attributes: {"img" => ["alt", "src", "title"], "a" => ["href"]}) + attributes: {"img" => ["alt", "src", "title"], "a" => ["href", "class"]}) res.gsub(prefix_emoji[0], "") if prefix_emoji end @@ -27,7 +25,8 @@ module Main url_regex = %r{(?]*(|/>))} text.gsub(url_regex) do |url| - %(#{url}) + clean_url = Sanitize.fragment(url).gsub(/\s/, "") + %(#{clean_url}) end end diff --git a/slices/main/templates/site/home.html.slim b/slices/main/templates/site/home.html.slim index ca9454a..6a91112 100644 --- a/slices/main/templates/site/home.html.slim +++ b/slices/main/templates/site/home.html.slim @@ -14,7 +14,7 @@ div class="mb-8 max-w-screen-md mx-auto border-t border-solid border-gray-200 da - if latest_status div class="h-entry mb-12 p-2 grid grid-cols-7 gap-4 min-h-16 max-w-prose mx-auto bg-fuchsia-100 dark:bg-fuchsia-800 dark:text-gray-200 rounded" div class="col-span-7 sm:col-span-6 text-left" - a class="u-url block my-auto hover:underline decoration-wavy" href=latest_status.permalink + a class="u-url block my-auto" href=latest_status.permalink span class="e-content status-body" - if latest_status.key_image img loading="lazy" class="float-start max-w-32 rounded mr-2" src=latest_status.key_image diff --git a/slices/micropub/decorators/posts/decorator.rb b/slices/micropub/decorators/posts/decorator.rb index edb5e45..b1deaf4 100644 --- a/slices/micropub/decorators/posts/decorator.rb +++ b/slices/micropub/decorators/posts/decorator.rb @@ -51,9 +51,9 @@ module Micropub def display_title title = name if prefix_emoji - return "#{prefix_emoji} #{title}" + "#{prefix_emoji} #{title}" else - return title + title end end