From 0515de42ef2b9b80d726b0e7593979697fbbc4df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Sat, 13 Feb 2021 17:30:30 +0100 Subject: Fix some bugs. --- do.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/do.py b/do.py index 43f6ebd..9b02cee 100755 --- a/do.py +++ b/do.py @@ -113,16 +113,19 @@ def resolve_mail(addr, frag, comment): if mode == 'tex': outstr += f'\\subsection{{{texify_filename(part.get_filename())}}}\n' elif mode == 'txt': + global subsectioncounter subsectioncounter += 1 outstr += f' {sectioncounter}.{subsectioncounter}. {part.get_filename()}\n' content = part.get_content() + if type(content) == bytes: + content = content.decode('utf-8') if max(len(s) for s in content.split('\n')) > 100: # outstr += '\\setlength\\parindent{24pt}' - outstr += part.get_content() + '\n' + outstr += content + '\n' else: if mode == 'tex': outstr += '\n\\begin{verbatim}' - outstr += part.get_content() + '\n' + outstr += content + '\n' if mode == 'tex': outstr += '\\end{verbatim}' # mail += f'{part.get_content_type()} - {part.get_filename()}\n' @@ -194,6 +197,7 @@ resolvers = { # ------------------------------------------------------------ +# TODO handle case where heading is missing def get_heading(name, data): start_match = re.search(f'(?m)^(=+) {name} =+$', data) print(start_match) -- cgit v1.2.3