colors: Remove additional newlines from code segments.

This commit is contained in:
Damir Jelić 2018-08-28 10:53:29 +02:00
parent 57c392a643
commit cb5a4ad1d7

View file

@ -290,7 +290,9 @@ class Formatted():
except ClassNotFound:
lexer = guess_lexer(string)
return highlight(string, lexer, WeechatFormatter())
# highlight adds a newline to the end of the string, remove it
# from the output
return highlight(string, lexer, WeechatFormatter())[:-1]
elif name == "fgcolor" and value:
return "{color_on}{text}{color_off}".format(
@ -433,8 +435,6 @@ class MatrixHtmlParser(HTMLParser):
elif tag == "code":
if self.text:
self.add_substring(self.text, self.attributes.copy())
self.text = "\n"
self.add_substring(self.text, DEFAULT_ATRIBUTES.copy())
self.text = ""
self.attributes["code"] = None
elif tag == "blockquote":