Strip extra spaces - stahg-gopher - Static Mercurial page generator for gopher HTML hg clone https://bitbucket.org/iamleot/stahg-gopher DIR Log DIR Files DIR Refs DIR README DIR LICENSE --- DIR changeset 1a8db084dc14790d9763d8d10f025e5504253098 DIR parent e1bbdedd6f75e5e8be656602737d3c69a810c23c HTML Author: Leonardo Taccari <iamleot@gmail.com> Date: Fri, 28 Jun 2019 11:30:57 Strip extra spaces Diffstat: stahg-gopher.py | 22 +++++++++++++--------- 1 files changed, 13 insertions(+), 9 deletions(-) --- diff -r e1bbdedd6f75 -r 1a8db084dc14 stahg-gopher.py --- a/stahg-gopher.py Fri Jun 07 15:08:12 2019 +0200 +++ b/stahg-gopher.py Fri Jun 28 11:30:57 2019 +0200 @@ -160,8 +160,8 @@ print(self.menu(), file=f) print('---', file=f) - print('{:16} {:40} {}'.format( - 'Date', 'Commit message', 'Author'), file=f) + print('{:16} {:40} {:20}'.format( + 'Date', 'Commit message', 'Author').strip(), file=f) for i, e in enumerate(self.client.log()): if self.limit and i > self.limit: print(' More commits remaining [...]', @@ -172,7 +172,8 @@ '{date:16} {commit_message:40} {author:20}'.format( date=e.date.strftime('%Y-%m-%d %H:%M'), commit_message=shorten(e.desc.decode(), 40), - author=shorten(author_name(e.author.decode()), 20))), + author=shorten(author_name(e.author.decode()), 20), + ).strip()), path='{base_path}/commit/{changeset}.gph'.format( base_path=bp, changeset=e.node.decode())), file=f) @@ -188,13 +189,13 @@ print(self.menu(), file=f) print('---', file=f) - print('{:10} {:68}'.format('Mode', 'Name'), file=f) + print('{:10} {:68}'.format('Mode', 'Name').strip(), file=f) for e in self.client.manifest(rev=b'tip'): print('[1|{desc}|{path}|server|port]'.format( desc=gph_escape_entry('{mode:10} {name:68}'.format( mode='-' + stat.filemode(int(e[1].decode(), base=8))[1:], - name=e[4].decode())), + name=e[4].decode()).strip()), path=gph_escape_entry('{base_path}/file/{file}.gph'.format( base_path=bp, file=e[4].decode()))), file=f) @@ -211,25 +212,28 @@ print('Branches', file=f) print(' {:32} {:16} {:26}'.format( - 'Name', 'Last commit date', 'Author'), file=f) + 'Name', 'Last commit date', 'Author').rstrip(), file=f) for name, _, changeset in self.client.branches(): print( gph_escape_text(' {name:32} {date:16} {author:26}'.format( name=shorten(name.decode(), 32), date=self.client[changeset].date().strftime('%Y-%m-%d %H:%M'), - author=shorten(author_name(self.client[changeset].author().decode()), 26))), + author=shorten(author_name(self.client[changeset].author().decode()), 26) + ).rstrip()), file=f) print(file=f) print('Tags', file=f) - print(' {:32} {:16} {:26}'.format('Name', 'Last commit date', 'Author'), file=f) + print(' {:32} {:16} {:26}'.format( + 'Name', 'Last commit date', 'Author').rstrip(), file=f) for name, _, changeset, _ in self.client.tags(): print( gph_escape_text(' {name:32} {date:16} {author:26}'.format( name=shorten(name.decode(), 32), date=self.client[changeset].date().strftime('%Y-%m-%d %H:%M'), - author=shorten(author_name(self.client[changeset].author().decode()), 26))), + author=shorten(author_name(self.client[changeset].author().decode()), 26) + ).rstrip()), file=f)