Fix typo: DEFAULT_ATRIBUTES -> DEFAULT_ATTRIBUTES
This commit is contained in:
parent
560c8d0c54
commit
a74ac888a3
2 changed files with 10 additions and 10 deletions
|
@ -62,7 +62,7 @@ class Formatted(object):
|
||||||
def is_formatted(self):
|
def is_formatted(self):
|
||||||
# type: (Formatted) -> bool
|
# type: (Formatted) -> bool
|
||||||
for string in self.substrings:
|
for string in self.substrings:
|
||||||
if string.attributes != DEFAULT_ATRIBUTES:
|
if string.attributes != DEFAULT_ATTRIBUTES:
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class Formatted(object):
|
||||||
"""
|
"""
|
||||||
text = "" # type: str
|
text = "" # type: str
|
||||||
substrings = [] # type: List[FormattedString]
|
substrings = [] # type: List[FormattedString]
|
||||||
attributes = DEFAULT_ATRIBUTES.copy()
|
attributes = DEFAULT_ATTRIBUTES.copy()
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
while i < len(line):
|
while i < len(line):
|
||||||
|
@ -165,7 +165,7 @@ class Formatted(object):
|
||||||
substrings.append(FormattedString(text, attributes.copy()))
|
substrings.append(FormattedString(text, attributes.copy()))
|
||||||
text = ""
|
text = ""
|
||||||
# Reset all the attributes
|
# Reset all the attributes
|
||||||
attributes = DEFAULT_ATRIBUTES.copy()
|
attributes = DEFAULT_ATTRIBUTES.copy()
|
||||||
i = i + 1
|
i = i + 1
|
||||||
# Italic
|
# Italic
|
||||||
elif line[i] == "\x1D":
|
elif line[i] == "\x1D":
|
||||||
|
@ -371,7 +371,7 @@ class Formatted(object):
|
||||||
|
|
||||||
|
|
||||||
# TODO this should be a typed dict.
|
# TODO this should be a typed dict.
|
||||||
DEFAULT_ATRIBUTES = {
|
DEFAULT_ATTRIBUTES = {
|
||||||
"bold": False,
|
"bold": False,
|
||||||
"italic": False,
|
"italic": False,
|
||||||
"underline": False,
|
"underline": False,
|
||||||
|
@ -390,7 +390,7 @@ class MatrixHtmlParser(HTMLParser):
|
||||||
HTMLParser.__init__(self)
|
HTMLParser.__init__(self)
|
||||||
self.text = "" # type: str
|
self.text = "" # type: str
|
||||||
self.substrings = [] # type: List[FormattedString]
|
self.substrings = [] # type: List[FormattedString]
|
||||||
self.attributes = DEFAULT_ATRIBUTES.copy()
|
self.attributes = DEFAULT_ATTRIBUTES.copy()
|
||||||
|
|
||||||
def unescape(self, text):
|
def unescape(self, text):
|
||||||
"""Shim to unescape HTML in both Python 2 and 3.
|
"""Shim to unescape HTML in both Python 2 and 3.
|
||||||
|
@ -442,13 +442,13 @@ class MatrixHtmlParser(HTMLParser):
|
||||||
if self.text:
|
if self.text:
|
||||||
self.add_substring(self.text, self.attributes.copy())
|
self.add_substring(self.text, self.attributes.copy())
|
||||||
self.text = "\n"
|
self.text = "\n"
|
||||||
self.add_substring(self.text, DEFAULT_ATRIBUTES.copy())
|
self.add_substring(self.text, DEFAULT_ATTRIBUTES.copy())
|
||||||
self.text = ""
|
self.text = ""
|
||||||
elif tag == "br":
|
elif tag == "br":
|
||||||
if self.text:
|
if self.text:
|
||||||
self.add_substring(self.text, self.attributes.copy())
|
self.add_substring(self.text, self.attributes.copy())
|
||||||
self.text = "\n"
|
self.text = "\n"
|
||||||
self.add_substring(self.text, DEFAULT_ATRIBUTES.copy())
|
self.add_substring(self.text, DEFAULT_ATTRIBUTES.copy())
|
||||||
self.text = ""
|
self.text = ""
|
||||||
elif tag == "font":
|
elif tag == "font":
|
||||||
for key, value in attrs:
|
for key, value in attrs:
|
||||||
|
@ -482,7 +482,7 @@ class MatrixHtmlParser(HTMLParser):
|
||||||
elif tag == "blockquote":
|
elif tag == "blockquote":
|
||||||
self._toggle_attribute("quote")
|
self._toggle_attribute("quote")
|
||||||
self.text = "\n"
|
self.text = "\n"
|
||||||
self.add_substring(self.text, DEFAULT_ATRIBUTES.copy())
|
self.add_substring(self.text, DEFAULT_ATTRIBUTES.copy())
|
||||||
self.text = ""
|
self.text = ""
|
||||||
elif tag == "font":
|
elif tag == "font":
|
||||||
if self.text:
|
if self.text:
|
||||||
|
|
|
@ -61,7 +61,7 @@ from .globals import SCRIPT_NAME, SERVERS, W, MAX_EVENTS
|
||||||
from .utf import utf8_decode
|
from .utf import utf8_decode
|
||||||
from .utils import create_server_buffer, key_from_value, server_buffer_prnt
|
from .utils import create_server_buffer, key_from_value, server_buffer_prnt
|
||||||
|
|
||||||
from .colors import Formatted, FormattedString, DEFAULT_ATRIBUTES
|
from .colors import Formatted, FormattedString, DEFAULT_ATTRIBUTES
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -728,7 +728,7 @@ class MatrixServer(object):
|
||||||
room_buffer.printed_before_ack_queue.append(uuid)
|
room_buffer.printed_before_ack_queue.append(uuid)
|
||||||
plain_message = formatted.to_weechat()
|
plain_message = formatted.to_weechat()
|
||||||
plain_message = W.string_remove_color(plain_message, "")
|
plain_message = W.string_remove_color(plain_message, "")
|
||||||
attributes = DEFAULT_ATRIBUTES.copy()
|
attributes = DEFAULT_ATTRIBUTES.copy()
|
||||||
attributes["fgcolor"] = G.CONFIG.color.unconfirmed_message
|
attributes["fgcolor"] = G.CONFIG.color.unconfirmed_message
|
||||||
new_formatted = Formatted([FormattedString(
|
new_formatted = Formatted([FormattedString(
|
||||||
plain_message,
|
plain_message,
|
||||||
|
|
Loading…
Add table
Reference in a new issue