INNER CODE UNIT · Python

fix_tab_content

CodeSmile-0000011110110111/LunyScript-RFC · scripts/fix-tabs-final.py:113

def fix_tab_content(tab_lines):
    """Fix formatting within a tab: LOC first, then concepts"""

    content = '\n'.join(tab_lines)

    # Pattern: **Concepts needed:** ... **Lines of code:** ...
    # Replace with: **Lines of code:** ...\n\n**Concepts needed:** ...
    pattern = r'\*\*Concepts needed:\*\* ([^\*]+)\*\*Lines of code:\*\* (\d+\+?)'
    replacement = r'**Lines of code:** \2\n\n**Concepts needed:** \1'

    content = re.sub(pattern, replacement, content)

    return content.split('\n')

def main():
    input_file = 'docs/CodeComparison.md'

    with open(input_file, 'r', encoding='utf-8') as f:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…