mirror of
https://github.com/ihabunek/toot
synced 2025-02-09 16:48:39 +01:00
Eliminate constructor
This commit is contained in:
parent
199a96625b
commit
a8b4c79716
@ -10,13 +10,11 @@ from typing import List, Tuple
|
|||||||
from urwid.util import decompose_tagmarkup
|
from urwid.util import decompose_tagmarkup
|
||||||
|
|
||||||
|
|
||||||
class ContentParser:
|
STYLE_NAMES = [p[0] for p in PALETTE]
|
||||||
def __init__(self):
|
|
||||||
self.palette_names = []
|
|
||||||
for p in PALETTE:
|
|
||||||
self.palette_names.append(p[0])
|
|
||||||
|
|
||||||
"""Parse a limited subset of HTML and create urwid widgets."""
|
|
||||||
|
class ContentParser:
|
||||||
|
"""Parse a limited subset of HTML and create urwid widgets."""
|
||||||
|
|
||||||
def html_to_widgets(self, html, recovery_attempt=False) -> List[urwid.Widget]:
|
def html_to_widgets(self, html, recovery_attempt=False) -> List[urwid.Widget]:
|
||||||
"""Convert html to urwid widgets"""
|
"""Convert html to urwid widgets"""
|
||||||
@ -187,7 +185,7 @@ class ContentParser:
|
|||||||
style_name = "class_" + "_".join(clss)
|
style_name = "class_" + "_".join(clss)
|
||||||
# return the class name, only if we
|
# return the class name, only if we
|
||||||
# find it as a defined palette name
|
# find it as a defined palette name
|
||||||
if style_name in self.palette_names:
|
if style_name in STYLE_NAMES:
|
||||||
return style_name
|
return style_name
|
||||||
|
|
||||||
# fallback to returning the tag name
|
# fallback to returning the tag name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user