#!/usr/bin/env python3
from __future__ import annotations

import os


HTML = '''\
<!doctype html>
<html>
<head><title>pygments pytest</title></head>
<body>{}</body>
</html>
'''


def main() -> int:
    links = ''.join(
        f'<li><a href="demo/{f}">{f}</a></li>'
        for f in sorted(os.listdir('demo')) if f.endswith('_pytest.html')
    )
    with open('index.html', 'w') as f:
        f.write(HTML.format(f'<ul>{links}</ul>'))
    return 0


if __name__ == '__main__':
    raise SystemExit(main())
