diff options
-rwxr-xr-x | do.py | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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) |