summaryrefslogtreecommitdiff
path: root/repo/www/generate-page.py
blob: c9fa0e45e1348b40f071eddf4744fb9cf07cea26 (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
40
41
42
43
44
#!/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(
        '--lua-filter', dest='filters', action='append',
        help='Lua filter to run the page through.'
    )
    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,
        arguments.filters,
        title=arguments.title,
        site_title=arguments.site_title
    )


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