[openstreetmap/openstreetmap-website] Shorten matching urls in linkify (PR #5844)

Anton Khorev notifications at github.com
Tue Mar 25 03:47:45 UTC 2025


After looking at #844 and #5780 I think that first we can do something with full osm urls. Before trying to match patterns like `key=value` or `changeset 12345` or `n12345` we need to check them for false positives/negatives among existing comments. And the first to do with urls that makes sense is to shorten them like [better-osm-org](https://github.com/deevroman/better-osm-org) does: replace `https://www.openstreetmap.org/` (and other osm domains) with `osm.org`. The only possible confusion here could be in comments like "When I tried opening https://www.osm.org/ ... but when I tried https://www.openstreetmap.org/ ..." that talk about different osm domains. Such comments are unlikely in plaintext changeset and note comments, and other editable texts support markdown syntax `[...](...)` where you can directly specify the visible text.

![image](https://github.com/user-attachments/assets/c63980d3-c916-425e-95ff-840c568b311b)

You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/5844

-- Commit Summary --

  * Remove html-safe/unsafe branches from rich text linkify
  * Split RichText text-to-html test
  * Shorten matching urls in linkify

-- File Changes --

    M config/settings.yml (4)
    M lib/rich_text.rb (12)
    M test/lib/rich_text_test.rb (55)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/5844.patch
https://github.com/openstreetmap/openstreetmap-website/pull/5844.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5844
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/5844 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20250324/1778035f/attachment.htm>


More information about the rails-dev mailing list