| import re |
| import os |
|
|
| def slugify(text): |
| text = re.sub(r'[^a-zA-Z0-9]', '_', text.lower()).strip('_') |
| return re.sub(r'_+', '_', text) |
|
|
| def generate_readme(input_md="e.md", output_md="README.md"): |
| with open(input_md, 'r', encoding='utf-8') as f: |
| lines = f.readlines() |
|
|
| readme_content = [ |
| "---", |
| "title: Reinforcement Learning Graphical Representations", |
| "date: 2026-04-08", |
| "category: Reinforcement Learning", |
| "description: A comprehensive gallery of 130 standard RL components and their graphical presentations.", |
| "---\n\n", |
| "# Reinforcement Learning Graphical Representations\n\n", |
| "This repository contains a full set of 130 visualizations representing foundational concepts, algorithms, and advanced topics in Reinforcement Learning.\n\n" |
| ] |
|
|
| |
| |
| |
| |
| header = "| Category | Component | Illustration | Details | Context |\n" |
| separator = "|----------|-----------|--------------|---------|---------|\n" |
| |
| readme_content.append(header) |
| readme_content.append(separator) |
|
|
| for line in lines: |
| if line.startswith("|") and "Category" not in line and "---" not in line: |
| parts = [p.strip() for p in line.split("|") if p.strip()] |
| if len(parts) >= 2: |
| category = parts[0] |
| component = parts[1].replace("**", "") |
| description = parts[2] |
| |
| context = parts[4] if len(parts) > 4 else "" |
| |
| img_name = slugify(component) + ".png" |
| img_link = f"" |
| |
| |
| |
| details = description |
| new_row = f"| {category} | **{component}** | {img_link} | {details} | {context} |\n" |
| readme_content.append(new_row) |
|
|
| with open(output_md, 'w', encoding='utf-8') as f: |
| f.writelines(readme_content) |
|
|
| print(f"[SUCCESS] Generated {output_md}") |
|
|
| if __name__ == "__main__": |
| generate_readme() |
|
|