import urllib.request, pathlib, json root=pathlib.Path(__file__).resolve().parents[1] repo='tfrere/research-article-template' rev='c75fc29c361755f66c46ae6e83d958b10c4d5feb' base=f'https://huggingface.co/spaces/{repo}/raw/{rev}/' paths=['LICENSE','app/src/components/TableOfContents.astro','app/src/components/ThemeToggle.astro','app/src/components/Wide.astro','app/src/components/Reference.astro','app/src/components/Note.astro','app/src/components/Accordion.astro','app/src/components/HtmlEmbed.astro'] for p in paths: data=urllib.request.urlopen(base+p).read() dest=root/('LICENSE.template' if p=='LICENSE' else p.removeprefix('app/')) dest.parent.mkdir(parents=True,exist_ok=True);dest.write_bytes(data) print('Downloaded',len(paths),'template files at',rev) (root/'docs/template-provenance.json').write_text(json.dumps({'repo':repo,'revision':rev,'files':paths},indent=2)+'\n')