summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2021-02-13 17:30:30 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2021-02-13 17:30:30 +0100
commit0515de42ef2b9b80d726b0e7593979697fbbc4df (patch)
tree2972923f752fdeb22f1e6aad6cb422c87129df56
parentAdd default output mode. (diff)
downloadvimwiki-scripts-0515de42ef2b9b80d726b0e7593979697fbbc4df.tar.gz
vimwiki-scripts-0515de42ef2b9b80d726b0e7593979697fbbc4df.tar.xz
Fix some bugs.
-rwxr-xr-xdo.py8
1 files 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)