From 4a83e624b2cbacdede4f57c95e8f91b3b1529aa9 Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Fri, 17 Jun 2016 14:58:24 +0300 Subject: [PATCH] bugfixes --- reporting/md_color.py | 6 +++++- reporting/src2ans | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/reporting/md_color.py b/reporting/md_color.py index ec5da71..8845a94 100755 --- a/reporting/md_color.py +++ b/reporting/md_color.py @@ -32,6 +32,8 @@ Special syntaxes: help="Disable color.") parser.add_argument("-z",action="store_true",dest="zero",default=False, help="Reset coloring at the end of each line.") + parser.add_argument("-Z",action="store_false",dest="zero_final",default=True, + help="Disable reset of colors at the end of file.") parser.add_argument("filename",type=str, help="File to show, - for stdin") opts=parser.parse_args() @@ -164,6 +166,7 @@ inlines=['bold1','bold2','code_special','code','image','link','underline','strik if __name__ == "__main__": opts=setup_options() + bc=ansi.code() if opts.filename=="-": f=sys.stdin else: @@ -183,5 +186,6 @@ if __name__ == "__main__": if opts.zero: sys.stdout.write(bc.Z) sys.stdout.write("\n") - + if opts.zero_final: + sys.stdout.write(bc.Z.encode('utf-8')) diff --git a/reporting/src2ans b/reporting/src2ans index 9a5557c..261c778 100755 --- a/reporting/src2ans +++ b/reporting/src2ans @@ -45,6 +45,8 @@ Special syntaxes: help="Disable color.") parser.add_argument("-z",action="store_true",dest="zero",default=False, help="Reset coloring at the end of each line.") + parser.add_argument("-Z",action="store_false",dest="zero_final",default=True, + help="Disable reset of colors at the end of file.") parser.add_argument("filename",type=str, help="File to show, - for stdin") opts=parser.parse_args() @@ -68,5 +70,6 @@ for row in f: if opts.zero: sys.stdout.write(bc.Z) sys.stdout.write("\n") - +if opts.zero_final: + sys.stdout.write(bc.Z.encode('utf-8'))