diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-05-21 00:22:02 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2022-05-21 00:23:09 +0200 |
commit | 896770ac9b12515fe9ef70a17d0a1ed302e2fa88 (patch) | |
tree | 4bbc0ddc1077d131f6cb5a0289b9932be409b4d7 | |
parent | Included wiki attachements now correct level. (diff) | |
download | vimwiki-scripts-896770ac9b12515fe9ef70a17d0a1ed302e2fa88.tar.gz vimwiki-scripts-896770ac9b12515fe9ef70a17d0a1ed302e2fa88.tar.xz |
Place main in procedure.
-rwxr-xr-x | do.py | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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() |