diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-09-28 22:10:56 +0200 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-10-01 22:53:27 +0200 |
| commit | be0d907de78c4689708573c03105059e04d2419f (patch) | |
| tree | 14e259ecdb20af1006a38bd20fd2f017186ed2ea /repo/www/generate-index.py | |
| parent | 50aef4a8e2b6a53c12febf3728dfd0587915d248 (diff) | |
| download | memory-leaks-be0d907de78c4689708573c03105059e04d2419f.tar.xz | |
Factor some code out
To make it easier to add a pre-processing step for Org files.
Diffstat (limited to 'repo/www/generate-index.py')
| -rwxr-xr-x | repo/www/generate-index.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/repo/www/generate-index.py b/repo/www/generate-index.py index 16d1874..3fe1212 100755 --- a/repo/www/generate-index.py +++ b/repo/www/generate-index.py @@ -10,7 +10,7 @@ from tempfile import NamedTemporaryFile from git import Repo -from helpers import deserialize_directories, generate_crumbs, pandoc +from helpers import deserialize_directories, generate_crumbs, PandocRunner def parse_arguments(): @@ -103,6 +103,11 @@ def main(arguments): if arguments.site_title is not None: metadata['sitetitle'] = arguments.site_title + pandoc = PandocRunner( + arguments.output, arguments.template, arguments.filters, + stylesheets, variables + ) + if readme is not None: repo_top = Repo(search_parent_directories=True).working_dir readme_path = Path(repo_top, target, readme) @@ -117,11 +122,8 @@ def main(arguments): toc.write(html_toc) toc.flush() - pandoc( - readme_path, arguments.output, - arguments.template, arguments.filters, stylesheets, - include_after=(toc.name,), - variables=variables, metadata=metadata + pandoc.run( + readme_path, include_after=(toc.name,), metadata=metadata ) return @@ -133,11 +135,8 @@ def main(arguments): metadata['pagetitle'] = toc_title metadata['title'] = 'Index' - pandoc( - dummy_readme.name, arguments.output, - arguments.template, arguments.filters, stylesheets, - include_after=(toc.name,), - variables=variables, metadata=metadata + pandoc.run( + dummy_readme.name, include_after=(toc.name,), metadata=metadata ) |
