From 3f23000b89a77b9847106eb80e31de4262916403 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Wed, 14 Apr 2021 14:26:11 +0200 Subject: [PATCH] rclpython: when not previewing, just output the file text, with no processing at all. Avoids spurious newlines --- src/filters/rclpython.py | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/filters/rclpython.py b/src/filters/rclpython.py index ea1edea8..2a4ca490 100755 --- a/src/filters/rclpython.py +++ b/src/filters/rclpython.py @@ -223,18 +223,6 @@ def colorize_file(file=None, outstream=sys.stdout, standalone=True): sourcefile.close() -def _htmlwrapplain(txt, title=b"", charset=b"utf-8"): - return \ - b'\n\n' + \ - title + \ - b'\n' + \ - b'\n' + \ - b'\n
\n' + \
-        rclexecm.htmlescape(txt) + \
-        b'
\n\n\n' - class PythonDump(RclBaseHandler): def __init__(self, em): super(PythonDump, self).__init__(em) @@ -246,7 +234,8 @@ class PythonDump(RclBaseHandler): colorize_file(fn, out) return out.getvalue() else: - return _htmlwrapplain(open(fn, 'rb').read()) + self.outputmimetype = "text/plain" + return open(fn, 'rb').read() if __name__ == '__main__': proto = rclexecm.RclExecM()