-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
web UI: add unicode-bidi: isolate spans around external content
fixes RTL/LTR override chars extending into UI and other text. thanks @electricduck, @tantek! for #1666
- Loading branch information
Showing
6 changed files
with
16 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,24 +191,24 @@ def test_user_link_page_path(self): | |
|
||
def test_user_link_pictures_true(self): | ||
self.assert_multiline_equals( | ||
'<span class="logo" title="Web">🌐</span> <a class="h-card u-author" rel="me" href="https://y.za/" title="y.za">y.za</a>', | ||
'<span class="logo" title="Web">🌐</span> <a class="h-card u-author" rel="me" href="https://y.za/" title="y.za"><span style="unicode-bidi: isolate">y.za</span></a>', | ||
self.user.user_link(pictures=True, handle=False)) | ||
|
||
self.user.obj = Object(id='a', as2=ACTOR) | ||
self.assert_multiline_equals( | ||
'<span class="logo" title="Web">🌐</span> <a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo"><img src="https://user.com/me.jpg" class="profile"> Mrs. ☕ Foo</a>', | ||
'<span class="logo" title="Web">🌐</span> <a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo"><img src="https://user.com/me.jpg" class="profile"> <span style="unicode-bidi: isolate">Mrs. ☕ Foo</span></a>', | ||
self.user.user_link(pictures=True, handle=False)) | ||
|
||
def test_user_link_pictures_false(self): | ||
self.user.obj = Object(id='a', as2=ACTOR) | ||
self.assert_multiline_equals( | ||
'<a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo">Mrs. ☕ Foo</a>', | ||
'<a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo"><span style="unicode-bidi: isolate">Mrs. ☕ Foo</span></a>', | ||
self.user.user_link(pictures=False, handle=False)) | ||
|
||
def test_user_link_handle_true(self): | ||
self.user.obj = Object(id='a', as2=ACTOR) | ||
self.assert_multiline_equals( | ||
'<a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo · y.za">Mrs. ☕ Foo · y.za</a>', | ||
'<a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo · y.za"><span style="unicode-bidi: isolate">Mrs. ☕ Foo</span> · y.za</a>', | ||
self.user.user_link(pictures=False, handle=True)) | ||
|
||
def test_user_link_name_false(self): | ||
|
@@ -225,13 +225,13 @@ def test_user_link_dont_duplicate_handle_as_name(self): | |
def test_user_link_proto(self): | ||
self.user.obj = Object(id='y.za', as2=ACTOR) | ||
self.assert_multiline_equals( | ||
'<a class="h-card u-author" rel="me" href="web:fake:y.za" title="Mrs. ☕ Foo · fake:handle:y.za">Mrs. ☕ Foo · fake:handle:y.za</a>', | ||
'<a class="h-card u-author" rel="me" href="web:fake:y.za" title="Mrs. ☕ Foo · fake:handle:y.za"><span style="unicode-bidi: isolate">Mrs. ☕ Foo</span> · fake:handle:y.za</a>', | ||
self.user.user_link(proto=Fake, handle=True)) | ||
|
||
def test_user_link_proto_fallback(self): | ||
self.user.obj = Object(id='y.za', as2=ACTOR) | ||
self.assert_multiline_equals( | ||
'<a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo · @[email protected]">Mrs. ☕ Foo · @[email protected]</a>', | ||
'<a class="h-card u-author" rel="me" href="https://y.za/" title="Mrs. ☕ Foo · @[email protected]"><span style="unicode-bidi: isolate">Mrs. ☕ Foo</span> · @[email protected]</a>', | ||
self.user.user_link(proto=ActivityPub, proto_fallback=True, handle=True)) | ||
|
||
def test_user_link_proto_not_enabled(self): | ||
|
@@ -714,7 +714,7 @@ def test_actor_link(self): | |
("""\ | ||
title="Alice"> | ||
<img class="profile" src="http://pic/" /> | ||
Alice""", {'actor': { | ||
<span style="unicode-bidi: isolate">Alice</span>""", {'actor': { | ||
'name': 'Alice', | ||
'icon': {'type': 'Image', 'url': 'http://pic'}, | ||
}}), | ||
|
@@ -763,7 +763,7 @@ def test_actor_link_sized(self): | |
self.assert_multiline_equals("""\ | ||
<a class="h-card u-author" href="" title="Alice"> | ||
<img class="profile" src="foo.jpg" width="32"/> | ||
Alice | ||
<span style="unicode-bidi: isolate">Alice</span> | ||
</a>""", obj.actor_link(sized=True), ignore_blanks=True) | ||
|
||
def test_actor_link_composite_url(self): | ||
|