diff options
author | mathieui <mathieui@mathieui.net> | 2018-07-21 17:09:52 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2018-07-21 17:09:52 +0200 |
commit | ea2d76864da2448152428a62fe5c7daaea6ab0d3 (patch) | |
tree | 7ac279bb9b1efbe6025a0435d4a121f11080fcb0 /poezio/xhtml.py | |
parent | 3ec153a6a01faca5445bb7c21e0d427bb5096320 (diff) | |
download | poezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.tar.gz poezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.tar.bz2 poezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.tar.xz poezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.zip |
yapf -rip
Diffstat (limited to 'poezio/xhtml.py')
-rw-r--r-- | poezio/xhtml.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/poezio/xhtml.py b/poezio/xhtml.py index 29a87ca2..7de048ae 100644 --- a/poezio/xhtml.py +++ b/poezio/xhtml.py @@ -208,8 +208,7 @@ def get_body_from_message_stanza(message, xhtml_body = xhtml.find('{http://www.w3.org/1999/xhtml}body') if xhtml_body is None: return message['body'] - content = xhtml_to_poezio_colors( - xhtml_body, tmp_dir=extract_images_to) + content = xhtml_to_poezio_colors(xhtml_body, tmp_dir=extract_images_to) content = content if content else message['body'] return content or " " @@ -356,7 +355,8 @@ class XHTMLHandler(sax.ContentHandler): elif name == 'em': self.append_formatting('\x19i') elif name == 'img': - if re.match(xhtml_data_re, attrs['src']) and self.tmp_image_dir is not None: + if re.match(xhtml_data_re, + attrs['src']) and self.tmp_image_dir is not None: type_, data = [ i for i in re.split(xhtml_data_re, attrs['src']) if i ] @@ -441,8 +441,7 @@ def xhtml_to_poezio_colors(xml, force=False, tmp_dir=None): elif not isinstance(xml, bytes): xml = ET.tostring(xml) - handler = XHTMLHandler( - force_ns=force, tmp_image_dir=tmp_dir) + handler = XHTMLHandler(force_ns=force, tmp_image_dir=tmp_dir) parser = sax.make_parser() parser.setFeature(sax.handler.feature_namespaces, True) parser.setContentHandler(handler) @@ -561,8 +560,8 @@ def poezio_colors_to_html(string): check_property('font-style', 'italic') if attr_char in digits: - number_str = string[next_attr_char + 1:string.find( - '}', next_attr_char)] + number_str = string[next_attr_char + + 1:string.find('}', next_attr_char)] number = int(number_str) if number in number_to_color_names: check_property('color', |