[openstreetmap/openstreetmap-website] Improve linkification scoping (PR #6612)

Marwin Hochfelsner notifications at github.com
Thu Dec 18 15:39:03 UTC 2025


@hlfan commented on this pull request.



> +                          .uniq
+                          .filter_map do |target|
+      r = RichText.new("text", "foo #{target} bar")
+      links = Nokogiri::HTML::DocumentFragment.parse(r.to_html).css("a")
+      target if links.empty?
+    end
+    key_links = WIKI_PAGES.values
+                          .flat_map { |l| l["key"]&.keys }
+                          .filter { |key| key && !%r{\*:|/|\*$}.match?(key) }
+                          .map { |l| "#{l}=*" }
+                          .uniq
+                          .filter_map do |target|
+      r = RichText.new("text", "foo #{target} bar")
+      links = Nokogiri::HTML::DocumentFragment.parse(r.to_html).css("a")
+      target if links.empty?
+    end

https://github.com/openstreetmap/openstreetmap-website/blob/07c068dc5ff4ed1e53ee6f1bb0367b643907ad4d/config/settings.yml#L173

The three `\u%%%%-\u%%%%` parts are roughly based on these blocks:
- Latin extensions
- Cyrillic
- Unified CJK

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

Message ID: <openstreetmap/openstreetmap-website/pull/6612/review/3593635833 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251218/9b20feb7/attachment-0001.htm>


More information about the rails-dev mailing list