summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-05-21 00:22:02 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-05-21 00:23:09 +0200
commit896770ac9b12515fe9ef70a17d0a1ed302e2fa88 (patch)
tree4bbc0ddc1077d131f6cb5a0289b9932be409b4d7
parentIncluded wiki attachements now correct level. (diff)
downloadvimwiki-scripts-896770ac9b12515fe9ef70a17d0a1ed302e2fa88.tar.gz
vimwiki-scripts-896770ac9b12515fe9ef70a17d0a1ed302e2fa88.tar.xz
Place main in procedure.
-rwxr-xr-xdo.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/do.py b/do.py
index 72720c1..d17a560 100755
--- a/do.py
+++ b/do.py
@@ -227,6 +227,7 @@ def resolve_file(mode, source_file_name, addr, frag, comment):
# elif extension == 'tex':
# return f'\\subfile{{{full_file}}}\n'
else:
+ print('PWD =', os.getcwd(), full_file)
with open(full_file, 'r') as f:
s = f.read() + '\n'
if mode == 'tex':
@@ -345,7 +346,7 @@ def renumber_wiki_headings(text):
text = re.sub('=' * length, '=' * (length - shortest + 1), text)
return text
-def format_wikitext(mode, paragraphs):
+def format_wikitext(output, mode, paragraphs):
if mode == 'txt':
for paragraph in paragraphs:
output.write('\n'.join(paragraph))
@@ -381,7 +382,9 @@ def format_wikitext(mode, paragraphs):
output.write('\\end{verbatim}\n')
-if __name__ == '__main__':
+def main():
+ global path_base
+
parser = argparse.ArgumentParser(
description='parse vimwiki files',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
@@ -574,7 +577,7 @@ if __name__ == '__main__':
d = options['date']
output.write(f'\n{heading.center(40)}\n{d.center(40)}\n')
- format_wikitext(mode, paragraphs)
+ format_wikitext(output, mode, paragraphs)
# Postamble
if mode == 'tex':
@@ -584,3 +587,8 @@ if __name__ == '__main__':
if mode == 'tex':
output.write('\\end{document}')
+
+
+
+if __name__ == '__main__':
+ main()