Fix f-string syntax error in template generation
- Split template writing into two parts to avoid f-string parsing issues
- Write version comment separately using f-string
- Write rest of template using regular string (avoids escaping CSS/JS braces)
- Fixes SyntaxError: f-string: expecting '=', or '!', or ':', or '}'
The issue occurred because CSS contains { } braces and % characters that
f-strings try to interpret. Now only the version comment uses f-string.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -961,10 +961,11 @@ def main():
|
||||
print(f"Creating new template at {template_file}")
|
||||
|
||||
with open(template_file, 'w') as f:
|
||||
f.write(f'''<!DOCTYPE html>
|
||||
# Write version comment first, then the rest of the template
|
||||
f.write(f'<!-- TEMPLATE_VERSION: {TEMPLATE_VERSION} -->\n')
|
||||
f.write('''<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<!-- TEMPLATE_VERSION: {TEMPLATE_VERSION} -->
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Rotary Phone Control Panel</title>
|
||||
|
||||
Reference in New Issue
Block a user