diff --git a/docs/build_docs.py b/docs/build_docs.py index 23e668dc..e75219aa 100644 --- a/docs/build_docs.py +++ b/docs/build_docs.py @@ -242,6 +242,29 @@ def remove_macros(): print(f"Removed {len(macros_indices)} URLs containing '/macros/' from {sitemap}") +def remove_comments_and_empty_lines(content, file_type): + """Removes comments and empty lines from a string of code, preserving newlines and URLs.""" + if file_type == "html": + # Remove HTML comments, preserving newline after comment + # content = re.sub(r"\n?", r"\n", content, flags=re.DOTALL) + pass + elif file_type == "css": + # Remove CSS comments, preserving newline after comment + # content = re.sub(r"/\*.*?\*/\n?", r"\n", content, flags=re.DOTALL) + pass + elif file_type == "js": + # Remove JS single-line comments, preserving newline and URLs + # content = re.sub(r"(?