diff --git a/scripts/generate-rst-comment.py b/scripts/generate-rst-comment.py index 1dcc0dca..08c6e20a 100644 --- a/scripts/generate-rst-comment.py +++ b/scripts/generate-rst-comment.py @@ -28,6 +28,13 @@ normalize_md, ) +# SPDX header to prepend to guideline files +GUIDELINE_FILE_HEADER = """\ +.. SPDX-License-Identifier: MIT OR Apache-2.0 + SPDX-FileCopyrightText: The Coding Guidelines Subcommittee Contributors + +""" + def extract_guideline_id(rst_content: str) -> str: """ @@ -57,6 +64,9 @@ def generate_comment(rst_content: str, chapter: str) -> str: chapter_slug = chapter_to_filename(chapter) guideline_id = extract_guideline_id(rst_content) + # Prepend the SPDX header to the RST content for display + full_rst_content = GUIDELINE_FILE_HEADER + rst_content.strip() + # Determine target path based on whether we have a guideline ID if guideline_id: target_dir = f"src/coding-guidelines/{chapter_slug}/" @@ -122,7 +132,7 @@ def generate_comment(rst_content: str, chapter: str) -> str: 📄 Click to expand RST content ```rst -{rst_content} +{full_rst_content} ```