20f06d0a57
React + Tailwind frontend, FastAPI backend, settings.json storage. Supports preset CRUD, live variable filling, and AI rewrite via OpenAI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
14 lines
313 B
Python
14 lines
313 B
Python
import re
|
|
|
|
VAR_RE = re.compile(r'\{\{([a-zA-Z_][a-zA-Z0-9_]*)\}\}')
|
|
|
|
|
|
def extract_vars(template: str) -> list[str]:
|
|
seen = set()
|
|
result = []
|
|
for m in VAR_RE.finditer(template):
|
|
if m.group(1) not in seen:
|
|
seen.add(m.group(1))
|
|
result.append(m.group(1))
|
|
return result
|