From 7b0b9ef2fc34ded3435f900812ef58da9d54f703 Mon Sep 17 00:00:00 2001 From: Dan Schwarz Date: Tue, 4 Apr 2023 19:43:37 -0400 Subject: [PATCH] renamed get_style_name to get_urwid_attr_name for clarity --- toot/tui/constants.py | 8 -------- toot/tui/richtext.py | 8 ++++---- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/toot/tui/constants.py b/toot/tui/constants.py index 2345001..d308070 100644 --- a/toot/tui/constants.py +++ b/toot/tui/constants.py @@ -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', ''), ] diff --git a/toot/tui/richtext.py b/toot/tui/richtext.py index a40f649..3cb842d 100644 --- a/toot/tui/richtext.py +++ b/toot/tui/richtext.py @@ -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