INNER CODE UNIT · Python
replace_tab_group
CodeSmile-0000011110110111/LunyScript-RFC · scripts/reorder-tabs.py:17
def replace_tab_group(match):
group_name = match.group(1)
all_content = match.group(2)
# Extract all four tab contents
tab_pattern = r'<div class="tab-content(.*?)" markdown="1">\s*(.*?)\s*</div>'
tabs = list(re.finditer(tab_pattern, all_content, re.DOTALL))
if len(tabs) != 4:
return match.group(0) # Return original if not 4 tabs
# Current order: LunyScript, Unity C#, Godot C#, GDScript (indices 0, 1, 2, 3)
# New order: LunyScript, GDScript, Godot C#, Unity C# (indices 0, 3, 2, 1)
reordered = [tabs[0], tabs[3], tabs[2], tabs[1]]
# Fix formatting in each tab content
def fix_formatting(tab_content):
# Pattern: **Concepts needed:** ... **Lines of code:** ...