Skip to content

Commit 02f9052

Browse files
authored
fix: include copyright header in generated guideline text for .rst.inc file (#281)
1 parent a0eb787 commit 02f9052

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

scripts/generate-rst-comment.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828
normalize_md,
2929
)
3030

31+
# SPDX header to prepend to guideline files
32+
GUIDELINE_FILE_HEADER = """\
33+
.. SPDX-License-Identifier: MIT OR Apache-2.0
34+
SPDX-FileCopyrightText: The Coding Guidelines Subcommittee Contributors
35+
36+
"""
37+
3138

3239
def extract_guideline_id(rst_content: str) -> str:
3340
"""
@@ -57,6 +64,9 @@ def generate_comment(rst_content: str, chapter: str) -> str:
5764
chapter_slug = chapter_to_filename(chapter)
5865
guideline_id = extract_guideline_id(rst_content)
5966

67+
# Prepend the SPDX header to the RST content for display
68+
full_rst_content = GUIDELINE_FILE_HEADER + rst_content.strip()
69+
6070
# Determine target path based on whether we have a guideline ID
6171
if guideline_id:
6272
target_dir = f"src/coding-guidelines/{chapter_slug}/"
@@ -122,7 +132,7 @@ def generate_comment(rst_content: str, chapter: str) -> str:
122132
<summary><strong>📄 Click to expand RST content</strong></summary>
123133
124134
```rst
125-
{rst_content}
135+
{full_rst_content}
126136
```
127137
128138
</details>

0 commit comments

Comments
 (0)