#!/usr/bin/env python3
"""Generate the five static GitHub Pages editions; no runtime dependencies."""
from pathlib import Path
import json
from html import escape as e
ROOT = Path(__file__).resolve().parents[1]
SITE = ROOT / 'site'
data = json.loads((SITE / 'content.json').read_text())
BASE = 'https://shihabal3amri.github.io/DiPlay/'
REPO = 'https://github.com/shihabal3amri/DiPlay'
RELEASE = REPO + '/releases/tag/v0.2.6'
DOWNLOAD = REPO + '/releases/download/v0.2.6/DiPlay-0.2.6.apk'
for lang, d in data.items():
folder = SITE if lang == 'en' else SITE / lang
folder.mkdir(exist_ok=True)
prefix = './' if lang == 'en' else '../'
url = BASE + ('' if lang == 'en' else lang + '/')
nav = ''.join(f'{e(v["name"])}' for code,v in data.items())
alternates = ''.join(f'' for code in data)
pics = ''.join(f'{e(cap)}' for pic,cap in zip(['home','settings'],d['captions']))
(folder/'index.html').write_text(f'''