Skip to content

Commit

Permalink
Implement CSS text-decoration blink
Browse files Browse the repository at this point in the history
  • Loading branch information
joouha committed Jan 12, 2024
1 parent 241420b commit 1a70f24
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Changed
Added
=====

- Implement CSS blink
- Implement progressive rendering in webview
- Pre-render terminal graphics to speed up notebook scrolling
- Add support for ``ruff`` code formatter
Expand Down
7 changes: 7 additions & 0 deletions euporie/core/ft/html.py
Original file line number Diff line number Diff line change
Expand Up @@ -1752,6 +1752,9 @@ def style(self) -> str:
if "line-through" in theme["text_decoration"]:
style = f"{style} strike"

if "blink" in theme["text_decoration"]:
style = f"{style} blink"

if self.hidden:
style = f"{style} hidden nounderline"

Expand Down Expand Up @@ -2094,6 +2097,10 @@ def __len__(self) -> int:
"display": "inline",
"font_weight": "bold",
},
((CssSelector(item="blink"),),): {
"display": "inline",
"text_decoration": "blink",
},
(
(CssSelector(item="cite"),),
(CssSelector(item="dfn"),),
Expand Down
9 changes: 9 additions & 0 deletions tests/test_core_ft_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ def test_hidden() -> None:
assert style.find("nounderline") > style.find("underline")


def test_blink() -> None:
"""Text with ``text-decoration: blink`` is rendered as spaces."""
data = '<span style="text-decoration: blink">a</span>'
result = to_formatted_text(HTML(data, width=1))
style, text, *_ = result[0]
# Hidden attribute is applied
assert "blink" in style


def test_hidden_underline_removal() -> None:
"""Underline attribute should be removed from hidden elements."""
data = 'a <u style="visibility:hidden">b</u> c'
Expand Down

0 comments on commit 1a70f24

Please sign in to comment.