@NeatNit commented on this pull request.
> +
+ "math" # don't know how this ends up, but dir="auto" is probably
correct
+ ].each do |name|
+ define_method :"convert_#{name}" do |el, indent|
+ attr_bak = el.attr.dup # can't avoid mutating the attr hash, so make
a backup
+ el.attr["dir"] = "auto" unless el.attr.key?("dir") # if by some
miracle dir is already defined, don't override it
+ ret = super(el, indent)
+ el.attr.replace(attr_bak) # restore backup
+ ret
+ end
+ end
+
+ # only add dir="auto" to bare links
+ def convert_a(el, indent)
+ attr_bak = el.attr.dup
+ el.attr["dir"] = "auto" if !el.attr.key?("dir") && el.attr["href"] ==
inner(el, indent)
You're right, the autolinker needs to apply `dir="auto"` or `dir="ltr"` too. My
code will pretty much only affect links made with the syntax
`<https://example.com/>` which is pretty obscure IMHO.
Links with custom text (`[text](url)`) *should not* have `dir`. Links made with
linkify need `dir="auto"` to handle cases like these:
מילים https://example.com/משהו/כלשהו
מילים https://example.com/משהו/כלשהו/index.html מילים
מילים https://example.com/ מילים
all of those links should render as isolated LTR. Note that GitHub falls here.
Whereas:
מספרים [one וגם two](https://example.com/numbers/) ועוד
the link direction should not be isolated - the word "one" should appear to the
right of "two". Result on GitHub is correct.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/5840#discussion_r2017676461
You are receiving this because you are subscribed to this thread.
Message ID:
<openstreetmap/openstreetmap-website/pull/5840/review/2723580...@github.com>
_______________________________________________
rails-dev mailing list
rails-dev@openstreetmap.org
https://lists.openstreetmap.org/listinfo/rails-dev