Skip to content

Commit

Permalink
fix: handle special css colors
Browse files Browse the repository at this point in the history
  • Loading branch information
vzhd1701 committed Jan 9, 2022
1 parent e58ac18 commit 8fbc393
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion enex2notion/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def _parse_style(style):
def _parse_css_color(color_token):
rgba = parse_color(color_token)

if rgba is None:
if rgba is None or rgba == "currentColor":
return None

float_to_int_rgb = 255
Expand Down
5 changes: 3 additions & 2 deletions tests/test_string_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,11 +223,12 @@ def test_extract_text_color_strange(parse_html):
test_note = parse_html(
'<div><span style="color:magentific;">strange</span></div>'
'<div><span style="background-color:magentific;">strange</span></div>'
'<div><span style="background-color:currentcolor;">strange</span></div>'
)

assert extract_string(test_note) == TextProp(
text="strange\nstrange",
properties=[["strange\nstrange"]],
text="strange\nstrange\nstrange",
properties=[["strange\nstrange\nstrange"]],
)


Expand Down

0 comments on commit 8fbc393

Please sign in to comment.