renamed get_style_name to get_urwid_attr_name for clarity

richtext
Dan Schwarz 2023-04-04 19:43:37 -04:00 zatwierdzone przez Ivan Habunek
rodzic e592cbe2ba
commit 7b0b9ef2fc
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: CDBD63C43A30BB95
2 zmienionych plików z 4 dodań i 12 usunięć

Wyświetl plik

@ -40,33 +40,25 @@ PALETTE = [
('white_bold', 'white,bold', ''),
# HTML tag styling
# note, anchor styling is often overridden
# by class names in Mastodon statuses
# so you won't see the italics.
('a', ',italics', ''),
('em', 'white,italics', ''),
('i', 'white,italics', ''),
('strong', 'white,bold', ''),
('b', 'white,bold', ''),
('u', 'white,underline', ''),
('del', 'white, strikethrough', ''),
('code', 'white, standout', ''),
('pre', 'white, standout', ''),
('blockquote', 'light gray', ''),
('h1', 'white, bold', ''),
('h2', 'white, bold', ''),
('h3', 'white, bold', ''),
('h4', 'white, bold', ''),
('h5', 'white, bold', ''),
('h6', 'white, bold', ''),
('class_mention_hashtag', 'light cyan,bold', ''),
]

Wyświetl plik

@ -100,7 +100,7 @@ class ContentParser:
return widget_list
def get_style_name(self, tag) -> str:
def get_urwid_attr_name(self, tag) -> str:
"""Get the class name and translate to a
name suitable for use as an urwid
text attribute name"""
@ -139,7 +139,7 @@ class ContentParser:
# in that case; set this up in constants.py
# to control highlighting of hashtags
return (self.get_style_name(tag), markups)
return (self.get_urwid_attr_name(tag), markups)
def _blockquote(self, tag) -> urwid.Widget:
widget_list = self.process_block_tag_children(tag)
@ -211,9 +211,9 @@ class ContentParser:
# of its own
if "class" in tag.attrs:
style_name = self.get_style_name(tag)
style_name = self.get_urwid_attr_name(tag)
elif tag.parent:
style_name = self.get_style_name(tag.parent)
style_name = self.get_urwid_attr_name(tag.parent)
else:
style_name = tag.name