# Released under the MIT License. See LICENSE for details.#"""Generates a pretty html changelog from our markdown."""importosimportsubprocess
[docs]defgenerate(projroot:str)->None:"""Main script entry point."""# Make sure we start from root dir (one above this script).os.chdir(projroot)out_path='build/changelog.html'out_path_tmp=out_path+'.md'# Do some filtering of our raw changelog.withopen('CHANGELOG.md',encoding='utf-8')asinfile:lines=infile.read().splitlines()# Strip out anything marked internal.lines=[lineforlineinlinesifnotline.strip().startswith('- (internal)')]withopen(out_path_tmp,'w',encoding='utf-8')asoutfile:outfile.write('\n'.join(lines))subprocess.run(f'pandoc -f markdown {out_path_tmp} > {out_path}',shell=True,check=True,)print(f'Generated changelog at \'{out_path}\'.')os.unlink(out_path_tmp)