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', ''),
|
('white_bold', 'white,bold', ''),
|
||||||
|
|
||||||
# HTML tag styling
|
# HTML tag styling
|
||||||
|
|
||||||
# note, anchor styling is often overridden
|
# note, anchor styling is often overridden
|
||||||
# by class names in Mastodon statuses
|
# by class names in Mastodon statuses
|
||||||
# so you won't see the italics.
|
# so you won't see the italics.
|
||||||
('a', ',italics', ''),
|
('a', ',italics', ''),
|
||||||
('em', 'white,italics', ''),
|
('em', 'white,italics', ''),
|
||||||
('i', 'white,italics', ''),
|
('i', 'white,italics', ''),
|
||||||
|
|
||||||
('strong', 'white,bold', ''),
|
('strong', 'white,bold', ''),
|
||||||
('b', 'white,bold', ''),
|
('b', 'white,bold', ''),
|
||||||
|
|
||||||
('u', 'white,underline', ''),
|
('u', 'white,underline', ''),
|
||||||
|
|
||||||
('del', 'white, strikethrough', ''),
|
('del', 'white, strikethrough', ''),
|
||||||
|
|
||||||
('code', 'white, standout', ''),
|
('code', 'white, standout', ''),
|
||||||
('pre', 'white, standout', ''),
|
('pre', 'white, standout', ''),
|
||||||
|
|
||||||
('blockquote', 'light gray', ''),
|
('blockquote', 'light gray', ''),
|
||||||
|
|
||||||
('h1', 'white, bold', ''),
|
('h1', 'white, bold', ''),
|
||||||
('h2', 'white, bold', ''),
|
('h2', 'white, bold', ''),
|
||||||
('h3', 'white, bold', ''),
|
('h3', 'white, bold', ''),
|
||||||
('h4', 'white, bold', ''),
|
('h4', 'white, bold', ''),
|
||||||
('h5', 'white, bold', ''),
|
('h5', 'white, bold', ''),
|
||||||
('h6', 'white, bold', ''),
|
('h6', 'white, bold', ''),
|
||||||
|
|
||||||
('class_mention_hashtag', 'light cyan,bold', ''),
|
('class_mention_hashtag', 'light cyan,bold', ''),
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ContentParser:
|
||||||
|
|
||||||
return widget_list
|
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
|
"""Get the class name and translate to a
|
||||||
name suitable for use as an urwid
|
name suitable for use as an urwid
|
||||||
text attribute name"""
|
text attribute name"""
|
||||||
|
@ -139,7 +139,7 @@ class ContentParser:
|
||||||
# in that case; set this up in constants.py
|
# in that case; set this up in constants.py
|
||||||
# to control highlighting of hashtags
|
# 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:
|
def _blockquote(self, tag) -> urwid.Widget:
|
||||||
widget_list = self.process_block_tag_children(tag)
|
widget_list = self.process_block_tag_children(tag)
|
||||||
|
@ -211,9 +211,9 @@ class ContentParser:
|
||||||
# of its own
|
# of its own
|
||||||
|
|
||||||
if "class" in tag.attrs:
|
if "class" in tag.attrs:
|
||||||
style_name = self.get_style_name(tag)
|
style_name = self.get_urwid_attr_name(tag)
|
||||||
elif tag.parent:
|
elif tag.parent:
|
||||||
style_name = self.get_style_name(tag.parent)
|
style_name = self.get_urwid_attr_name(tag.parent)
|
||||||
else:
|
else:
|
||||||
style_name = tag.name
|
style_name = tag.name
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue