summaryrefslogtreecommitdiff
path: root/repo/www/generate-page.py
blob: 372e8a208cbabd55ebe29a2c660be11f2c773677 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env python3

from argparse import ArgumentParser

from helpers import pandoc


def parse_arguments():
    parser = ArgumentParser()
    parser.add_argument(
        '--template', help='Pandoc template for HTML output.'
    )
    parser.add_argument(
        '--site-title', help='Prefix to add to <title>.'
    )
    parser.add_argument(
        '--title', help='Page title.'
    )
    parser.add_argument(
        'page', help='Page to convert to HTML.'
    )
    parser.add_argument(
        'output', help='Path to the output file.'
    )
    return parser.parse_args()


def main(arguments):
    pandoc(
        arguments.page,
        arguments.output,
        arguments.template,
        title=arguments.title,
        site_title=arguments.site_title
    )


if __name__ == '__main__':
    main(parse_arguments())