diff options
| author | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-03-24 23:07:17 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@gmail.com> | 2020-03-24 23:07:17 +0100 |
| commit | 355b77c1fff8132cd3445c375140cf51e736d8a0 (patch) | |
| tree | f622bf8adaf63a46c09b1dce984da643f762057f /repo/www/make-index.py | |
| parent | d7d98af0080241600bf0198f5c0942c96f3d2f95 (diff) | |
| download | memory-leaks-355b77c1fff8132cd3445c375140cf51e736d8a0.tar.xz | |
Produce auto-generated indices on stdout
This way I can concatenate the output with regular indices.
Diffstat (limited to 'repo/www/make-index.py')
| -rwxr-xr-x | repo/www/make-index.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/repo/www/make-index.py b/repo/www/make-index.py index 07aa266..ef699f0 100755 --- a/repo/www/make-index.py +++ b/repo/www/make-index.py @@ -10,10 +10,10 @@ from helpers import compute_directories def parse_arguments(args): - if len(args) != 4: - exit(f'Usage: {argv[0]} EXTENSIONS FOLDER OUTPUT-DIR') + if len(args) != 3: + exit(f'Usage: {argv[0]} EXTENSIONS FOLDER') - return argv[1].split(), argv[2], argv[3] + return argv[1].split(), argv[2] def list_files(extensions, folder): @@ -38,7 +38,7 @@ def generate_index_page(title, directories, files): def main(arguments): - extensions, folder, out_dir = parse_arguments(arguments) + extensions, folder = parse_arguments(arguments) title = path.basename(folder) if folder else 'index' @@ -47,8 +47,7 @@ def main(arguments): parsed_filenames = (path.splitext(f) for f in files) names = tuple(name for name, _ in parsed_filenames) - with open(path.join(out_dir, folder, 'index.html'), 'w') as index: - index.write(generate_index_page(title, folders, names)) + print(generate_index_page(title, folders, names)) if __name__ == '__main__': |
