Skip to content

Commit 3bae412

Browse files
📝 Add docstrings to dev-from-macmini
Docstrings generation was requested by @myoshi2891. The following files were modified: * `generate_index.py` These file types are not supported: * `.agent/skills/code-review-guidelines/SKILL.md` * `.agent/skills/general-implementation-rules/SKILL.md` * `Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/README_react.html` * `DataStructures/Stacks/leetcode/84. Largest Rectangle in Histogram/GPT/README.html` * `DataStructures/Stacks/leetcode/84. Largest Rectangle in Histogram/GPT/README_tailwind.html` * `Gemini.md` * `Mathematics/Fundamentals/HackerRank/Claude/Easy/Sherlock and Divisors/Sherlock_and_Divisors.ipynb` * `SQL/Leetcode/Intermediate Select/1193. Monthly Transactions I/Claude Sonnet 4.6 Extended/Monthly_Transactions_I.html` * `SQL/Leetcode/Intermediate Select/1193. Monthly Transactions I/Claude Sonnet 4.6 Extended/Monthly_Transactions_I_pandas.md` * `SQL/Leetcode/Intermediate Select/1193. Monthly Transactions I/Claude Sonnet 4.6 Extended/Monthly_Transactions_I_postgresql.md` * `public/Algorithm/Other/leetcode/66. Plus One/Claude Sonnet 4.5/README_react.html` * `public/DataStructures/Stacks/leetcode/84. Largest Rectangle in Histogram/GPT/README.html` * `public/DataStructures/Stacks/leetcode/84. Largest Rectangle in Histogram/GPT/README_tailwind.html` * `public/DataStructures/Stacks/leetcode/85. Maximal Rectangle/GPT/README.html` * `public/SQL/Leetcode/Intermediate Select/1193. Monthly Transactions I/Claude Sonnet 4.6 Extended/Monthly_Transactions_I.html` * `public/index.html`
1 parent 1c22fcf commit 3bae412

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

generate_index.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,22 @@ def copy_vendor_files(self, output_dir: str) -> None:
7878

7979
def rewrite_html_content(self, content: str) -> str:
8080
"""
81-
Rewrite HTML content by replacing known CDN asset URLs with local /vendor/ paths and removing `integrity` and `crossorigin` attributes from tags that reference those local vendor files.
81+
Rewrite HTML to replace known CDN asset URLs with local `/vendor/` paths and remove SRI and crossorigin attributes from tags that reference those local assets.
8282
8383
Parameters:
8484
content (str): HTML document content to rewrite.
8585
8686
Returns:
87-
str: HTML content with matching CDN URLs substituted with local vendor URLs and SRI/crossorigin attributes removed from tags referencing `/vendor/`.
87+
str: HTML content with matching CDN URLs substituted by local `/vendor/` URLs and `integrity`/`crossorigin` attributes removed from tags that reference `/vendor/`.
88+
"""
89+
"""
90+
Remove `integrity` and `crossorigin` attributes from a matched <link> or <script> tag when it references a `/vendor/` path.
91+
92+
Parameters:
93+
match (typing.Match[str]): A regex match whose matched text is the full HTML tag.
94+
95+
Returns:
96+
str: The tag text with `integrity` and `crossorigin` attributes removed if the tag contains `/vendor/`, otherwise the original tag text.
8897
"""
8998
replacements = [
9099
# React
@@ -117,13 +126,13 @@ def rewrite_html_content(self, content: str) -> str:
117126
# Strip integrity and crossorigin attributes from tags referencing local /vendor/ files
118127
def strip_sri(match: typing.Match[str]) -> str:
119128
"""
120-
Strip `integrity` and `crossorigin` attributes from a <link> or <script> tag that references a `/vendor/` path.
129+
Remove `integrity` and `crossorigin` attributes from an HTML `<link>` or `<script>` tag that references a `/vendor/` path.
121130
122131
Parameters:
123-
match (typing.Match[str]): A regex match whose matched text is the full HTML tag.
132+
match (typing.Match[str]): Regex match whose matched text is the full HTML tag to process.
124133
125134
Returns:
126-
str: The tag text with `integrity` and `crossorigin` attributes removed when the tag contains `/vendor/`, otherwise the original tag text.
135+
str: The tag text with `integrity` and `crossorigin` attributes removed if the tag contains `/vendor/`, otherwise the original tag text.
127136
"""
128137
tag_text = match.group(0)
129138
if '/vendor/' in tag_text:

0 commit comments

Comments
 (0)