From 2401c22c2442b0db767033b95100c657af455290 Mon Sep 17 00:00:00 2001 From: Pete LeVasseur Date: Sat, 13 Dec 2025 06:40:15 +0900 Subject: [PATCH] fix: include copyright header in generated guideline text for .rst.inc file --- scripts/generate-rst-comment.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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} ```