From cb5a4ad1d7a4ab8a7a1fcd12048a04a93ef14914 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Tue, 28 Aug 2018 10:53:29 +0200 Subject: [PATCH] colors: Remove additional newlines from code segments. --- matrix/colors.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/matrix/colors.py b/matrix/colors.py index 85cbe24..322197f 100644 --- a/matrix/colors.py +++ b/matrix/colors.py @@ -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":