diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-02-13 17:30:30 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-02-13 17:30:30 +0100 |
commit | 0515de42ef2b9b80d726b0e7593979697fbbc4df (patch) | |
tree | 2972923f752fdeb22f1e6aad6cb422c87129df56 | |
parent | Add default output mode. (diff) | |
download | vimwiki-scripts-0515de42ef2b9b80d726b0e7593979697fbbc4df.tar.gz vimwiki-scripts-0515de42ef2b9b80d726b0e7593979697fbbc4df.tar.xz |
Fix some bugs.
-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) |