diff --git a/scripts/pull_osbuild_modules.py b/scripts/pull_osbuild_modules.py index 3da23cee89..ae4a960947 100755 --- a/scripts/pull_osbuild_modules.py +++ b/scripts/pull_osbuild_modules.py @@ -7,6 +7,11 @@ import tempfile TEMPLATE = """ + # {title} **{summary}** @@ -81,6 +86,7 @@ def main(): ), schema_1=json.dumps(datas.get("schema", {}), indent=2), schema_2=json.dumps(datas.get("schema_2", {}), indent=2), + originating_url=f"https://github.com/osbuild/osbuild/tree/main/{tiep}/{schema.name}", ) (dest / f"{title}.md").write_text(text) diff --git a/scripts/pull_readmes.py b/scripts/pull_readmes.py index 915ad40302..f015d5e978 100644 --- a/scripts/pull_readmes.py +++ b/scripts/pull_readmes.py @@ -5,6 +5,13 @@ import os import requests +TEMPLATE = """ + +""" def resolve_dirs(baseurl, relative_link): """ @@ -100,13 +107,15 @@ def main(): source, targetpath = line.strip().split(':') if source and targetpath: + originating_url = f"{github_baseurl}/{source}" print(f"Downloading {github_rawurl}/{source} to {targetpath}...") download_file(f'{github_rawurl}/{source}', targetpath) print("Download completed.") - - parsed_md = parse_markdown_and_replace_links(targetpath, f'{github_baseurl}/{source}') + + parsed_md = parse_markdown_and_replace_links(targetpath, originating_url) with open(targetpath, 'w', encoding='utf-8') as output_file: + output_file.write(TEMPLATE.format(originating_url=originating_url)) output_file.write(parsed_md) print(f"Parsing and link replacement completed. Output saved to '{targetpath}'")