[openstreetmap/openstreetmap-website] Pass on 'rel="me"' attribute for Mastodon Links (Issue #3859)

Pieter Vander Vennet notifications at github.com
Thu Dec 29 17:49:46 UTC 2022


I used `:attributes`, not `:add_attributes` here - a small difference that is easy to miss.

This would _allow_ `rel=me` to be used, but not _add_ them to every link.

The full code would then look like

``` ruby
Sanitize::Config::OSM = Sanitize::Config.merge(
  Sanitize::Config::RELAXED,
  :elements => Sanitize::Config::RELAXED[:elements] - %w[div style],

  :attributes => { "a" => { "rel" => "me" } },  # Whitelist rel=me

  :add_attributes => { "a" => { "rel" => "nofollow noopener noreferrer" } },
  :remove_contents => %w[script style],
  :transformers => lambda do |env|
    env[:node].remove_class
    env[:node].kwattr_remove("style", nil)
    env[:node].add_class("table table-sm w-auto") if env[:node_name] == "table"
  end
)
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/3859#issuecomment-1367490734
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/issues/3859/1367490734 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20221229/9f8a228c/attachment.htm>


More information about the rails-dev mailing list