kopia lustrzana https://github.com/ihabunek/toot
renamed get_style_name to get_urwid_attr_name for clarity
rodzic
e592cbe2ba
commit
7b0b9ef2fc
|
@ -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', ''),
|
||||
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue