Properly escape file contents in file() - stahg-gopher - Static Mercurial page generator for gopher
 (HTM) hg clone https://bitbucket.org/iamleot/stahg-gopher
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) changeset 62096a70ea4aa36f8a046b6e23f40cff334f0a40
 (DIR) parent e6a57c6a75d1a3bcfda619301305129e76b219ce
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Thu, 16 May 2019 18:47:43 
       
       Properly escape file contents in file()
       
       Previously only the line (without line number) was escaped leading
       to possible duplicate leading `t' in the file contents.
       
       Diffstat:
        stahg-gopher.py |  4 ++--
        1 files changed, 2 insertions(+), 2 deletions(-)
       ---
       diff -r e6a57c6a75d1 -r 62096a70ea4a stahg-gopher.py
       --- a/stahg-gopher.py   Thu May 16 00:25:17 2019 +0200
       +++ b/stahg-gopher.py   Thu May 16 18:47:43 2019 +0200
       @@ -297,9 +297,9 @@
                    try:
                        content = self.client.cat(files).decode()
                        for num, line in enumerate(content.splitlines(), start=1):
       -                    print('{num:6d} {line}'.format(
       +                    print(gph_escape_text('{num:6d} {line}'.format(
                                num=num,
       -                        line=gph_escape_text(line)), file=f)
       +                        line=line)), file=f)
                    except:
                        print('Binary file.', file=f)