htmlxify 1.0.1__tar.gz → 1.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. {htmlxify-1.0.1 → htmlxify-1.0.2}/PKG-INFO +116 -6
  2. {htmlxify-1.0.1 → htmlxify-1.0.2}/README.md +115 -5
  3. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/cli.py +34 -46
  4. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/generators/html_gen.py +13 -7
  5. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/parser/ast_builder.py +34 -0
  6. htmlxify-1.0.2/htmlxify/parser/escape_preprocessor.py +146 -0
  7. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/parser/grammar.lark +9 -8
  8. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/validator/semantic.py +8 -4
  9. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify.egg-info/PKG-INFO +116 -6
  10. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify.egg-info/SOURCES.txt +5 -1
  11. htmlxify-1.0.2/htmlxify.egg-info/entry_points.txt +3 -0
  12. htmlxify-1.0.2/htmlxify.egg-info/top_level.txt +2 -0
  13. htmlxify-1.0.2/language_server/__init__.py +25 -0
  14. htmlxify-1.0.2/language_server/__main__.py +12 -0
  15. htmlxify-1.0.2/language_server/server.py +1304 -0
  16. {htmlxify-1.0.1 → htmlxify-1.0.2}/setup.py +9 -1
  17. htmlxify-1.0.1/htmlxify.egg-info/entry_points.txt +0 -2
  18. htmlxify-1.0.1/htmlxify.egg-info/top_level.txt +0 -1
  19. {htmlxify-1.0.1 → htmlxify-1.0.2}/LICENSE +0 -0
  20. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/__init__.py +0 -0
  21. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/generators/__init__.py +0 -0
  22. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/generators/css_gen.py +0 -0
  23. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/generators/js_gen.py +0 -0
  24. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/parser/__init__.py +0 -0
  25. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/parser/indent_processor.py +0 -0
  26. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/utils/__init__.py +0 -0
  27. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify/validator/__init__.py +0 -0
  28. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify.egg-info/dependency_links.txt +0 -0
  29. {htmlxify-1.0.1 → htmlxify-1.0.2}/htmlxify.egg-info/requires.txt +0 -0
  30. {htmlxify-1.0.1 → htmlxify-1.0.2}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: htmlxify
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: htmlxify - A simplified web markup language compiler that transpiles to HTML, CSS, and JavaScript
5
5
  Home-page: https://github.com/Aquib489/htmlxify
6
6
  Author: Aquib489
@@ -136,7 +136,10 @@ HTMLXIFY page.HTMLXIFY output/
136
136
  - ✅ **Production Ready** - Generates clean, optimized code
137
137
  - ✅ **Void Elements** - Proper `<br>`, `<img>`, `<input>`, `<meta>`, etc. handling
138
138
  - ✅ **Escape Sequences** - Support for `/{`, `/}`, `/(`, `/)`
139
+ - ✅ **Escape Blocks** - Raw content with `escape{ }` preserving braces, parentheses
139
140
  - ✅ **Boolean Attributes** - HTML5 booleans like `disabled`, `checked`, `required`
141
+ - ✅ **@ Alias** - Use `@-call` and `@-data` as alternatives to `⚡-call` and `⚡-data`
142
+ - ✅ **Language Server** - LSP support for all IDEs (VS Code, Neovim, Sublime, etc.)
140
143
 
141
144
  ## 📋 Implementation Status
142
145
 
@@ -148,19 +151,19 @@ HTMLXIFY page.HTMLXIFY output/
148
151
  | **JavaScript Generator** | ✅ Complete (10.6 KB with API handlers) |
149
152
  | **CLI Tool** | ✅ Complete & tested |
150
153
  | **Standalone Executable** | ✅ Built for distribution (PyPI package) |
151
- | **Backend Integration** | ✅ Complete (API calls with ⚡-call) |
154
+ | **Backend Integration** | ✅ Complete (API calls with ⚡-call / @-call) |
152
155
  | **Semantic Validator** | ✅ Complete |
153
- | **VS Code Extension** | 🔄 Planned |
154
- | **Language Server** | 🔄 Planned |
156
+ | **Escape Blocks** | ✅ Complete (raw content with braces, parens) |
157
+ | **Language Server (LSP)** | ✅ Complete (works with all IDEs) |
155
158
 
156
159
  ## 🚀 Quick Start
157
160
 
158
161
  ### Installation
159
162
 
160
- **Option 1: Install from TestPyPI (Recommended)**
163
+ **Option 1: Install from PyPI (Recommended)**
161
164
 
162
165
  ```bash
163
- pip install -i https://test.pypi.org/simple/ HTMLXIFY
166
+ pip install htmlxify
164
167
  ```
165
168
 
166
169
  Then use the command:
@@ -289,6 +292,41 @@ code { function/(/)/() /{ return true; /} }
289
292
  p { Price: $99.99 (50% off) and formula: x^2 }
290
293
  ```
291
294
 
295
+ ### Escape Blocks
296
+
297
+ For larger blocks of raw content with special characters, use `escape{ }`:
298
+
299
+ ```markup
300
+ // Code with braces and parentheses
301
+ pre {
302
+ escape{
303
+ function greet() {
304
+ console.log("Hello!");
305
+ }
306
+ }
307
+ }
308
+
309
+ // Preserves everything: {}, (), whitespace, special chars
310
+ article {
311
+ h3 { Code Example }
312
+ pre { escape{
313
+ {}
314
+ ()
315
+ ⚡-call
316
+ @-data
317
+ #$%^&*()
318
+
319
+ Blank lines preserved!
320
+ } }
321
+ }
322
+ ```
323
+
324
+ The `escape{ }` block:
325
+ - Preserves all special characters literally
326
+ - Maintains whitespace and blank lines
327
+ - Handles nested braces correctly
328
+ - Perfect for code snippets, formulas, JSON
329
+
292
330
  ### Nesting
293
331
 
294
332
  ```markup
@@ -326,9 +364,15 @@ div {
326
364
  ### Backend Integration
327
365
 
328
366
  ```markup
367
+ // Using ⚡ symbol
329
368
  button(⚡-call: "selectPlan", data-plan: "starter") {
330
369
  Select Plan
331
370
  }
371
+
372
+ // Using @ alias (same functionality)
373
+ button(@-call: "selectPlan", data-plan: "starter") {
374
+ Select Plan
375
+ }
332
376
  ```
333
377
 
334
378
  This generates:
@@ -345,9 +389,15 @@ This generates:
345
389
  ### Dynamic Data Binding
346
390
 
347
391
  ```markup
392
+ // Using ⚡ symbol
348
393
  div(⚡-data: "userData") {
349
394
  p { User information }
350
395
  }
396
+
397
+ // Using @ alias
398
+ div(@-data: "userData") {
399
+ p { User information }
400
+ }
351
401
  ```
352
402
 
353
403
  In JavaScript, update it dynamically:
@@ -723,6 +773,66 @@ python cli.py input.HTMLXIFY output/ --verbose
723
773
  3. Upload HTML, CSS, JS to any web server
724
774
  4. Done! Your site is live 🚀
725
775
 
776
+ ## 🖥️ IDE Support (Language Server)
777
+
778
+ HTMLXIFY includes a **professional-grade Language Server Protocol (LSP)** implementation that works with any IDE:
779
+
780
+ ### Features (18+ LSP capabilities)
781
+
782
+ **Core Features:**
783
+ - ✅ Real-time error detection (parser diagnostics)
784
+ - ✅ Code completion (100+ HTML tags, attributes, escape blocks, snippets)
785
+ - ✅ Hover documentation (tags, @-call/@-data, escape blocks)
786
+ - ✅ Document outline/symbols (tags, IDs, classes hierarchy)
787
+ - ✅ Auto-formatting (smart indentation)
788
+
789
+ **Navigation:**
790
+ - ✅ Go-to-definition (jump to ID/class definitions)
791
+ - ✅ Find all references (locate all usages of ID/class)
792
+ - ✅ Workspace symbol search (Ctrl+T to find symbols across files)
793
+
794
+ **Editing:**
795
+ - ✅ Rename support (rename IDs/classes across document)
796
+ - ✅ Code actions (quick fixes for void elements, missing braces)
797
+ - ✅ Signature help (attribute hints while typing)
798
+ - ✅ Document highlight (highlight matching symbols)
799
+
800
+ **Code Intelligence:**
801
+ - ✅ Folding ranges (collapse/expand code blocks)
802
+ - ✅ Selection range (smart expand/shrink selection)
803
+ - ✅ Document links (clickable URLs in code)
804
+
805
+ ### VS Code Setup
806
+ ```json
807
+ // .vscode/settings.json
808
+ {
809
+ "htmlxify.languageServer.command": "htmlxify-lsp"
810
+ }
811
+ ```
812
+
813
+ ### Neovim Setup
814
+ ```lua
815
+ -- init.lua
816
+ require('lspconfig').htmlxify.setup{
817
+ cmd = { 'htmlxify-lsp' },
818
+ filetypes = { 'htmlx', 'htmlxify' },
819
+ }
820
+ ```
821
+
822
+ ### Other IDEs
823
+ The language server works with Sublime Text, Emacs, JetBrains IDEs, Helix, and any editor supporting LSP.
824
+
825
+ See `language_server/README.md` for detailed setup instructions.
826
+
827
+ ### Running the Server
828
+ ```bash
829
+ # After pip install
830
+ htmlxify-lsp
831
+
832
+ # Or directly
833
+ python -m language_server
834
+ ```
835
+
726
836
  ## 🎯 Next Steps
727
837
 
728
838
  After installing and creating your first file:
@@ -75,7 +75,10 @@ HTMLXIFY page.HTMLXIFY output/
75
75
  - ✅ **Production Ready** - Generates clean, optimized code
76
76
  - ✅ **Void Elements** - Proper `<br>`, `<img>`, `<input>`, `<meta>`, etc. handling
77
77
  - ✅ **Escape Sequences** - Support for `/{`, `/}`, `/(`, `/)`
78
+ - ✅ **Escape Blocks** - Raw content with `escape{ }` preserving braces, parentheses
78
79
  - ✅ **Boolean Attributes** - HTML5 booleans like `disabled`, `checked`, `required`
80
+ - ✅ **@ Alias** - Use `@-call` and `@-data` as alternatives to `⚡-call` and `⚡-data`
81
+ - ✅ **Language Server** - LSP support for all IDEs (VS Code, Neovim, Sublime, etc.)
79
82
 
80
83
  ## 📋 Implementation Status
81
84
 
@@ -87,19 +90,19 @@ HTMLXIFY page.HTMLXIFY output/
87
90
  | **JavaScript Generator** | ✅ Complete (10.6 KB with API handlers) |
88
91
  | **CLI Tool** | ✅ Complete & tested |
89
92
  | **Standalone Executable** | ✅ Built for distribution (PyPI package) |
90
- | **Backend Integration** | ✅ Complete (API calls with ⚡-call) |
93
+ | **Backend Integration** | ✅ Complete (API calls with ⚡-call / @-call) |
91
94
  | **Semantic Validator** | ✅ Complete |
92
- | **VS Code Extension** | 🔄 Planned |
93
- | **Language Server** | 🔄 Planned |
95
+ | **Escape Blocks** | ✅ Complete (raw content with braces, parens) |
96
+ | **Language Server (LSP)** | ✅ Complete (works with all IDEs) |
94
97
 
95
98
  ## 🚀 Quick Start
96
99
 
97
100
  ### Installation
98
101
 
99
- **Option 1: Install from TestPyPI (Recommended)**
102
+ **Option 1: Install from PyPI (Recommended)**
100
103
 
101
104
  ```bash
102
- pip install -i https://test.pypi.org/simple/ HTMLXIFY
105
+ pip install htmlxify
103
106
  ```
104
107
 
105
108
  Then use the command:
@@ -228,6 +231,41 @@ code { function/(/)/() /{ return true; /} }
228
231
  p { Price: $99.99 (50% off) and formula: x^2 }
229
232
  ```
230
233
 
234
+ ### Escape Blocks
235
+
236
+ For larger blocks of raw content with special characters, use `escape{ }`:
237
+
238
+ ```markup
239
+ // Code with braces and parentheses
240
+ pre {
241
+ escape{
242
+ function greet() {
243
+ console.log("Hello!");
244
+ }
245
+ }
246
+ }
247
+
248
+ // Preserves everything: {}, (), whitespace, special chars
249
+ article {
250
+ h3 { Code Example }
251
+ pre { escape{
252
+ {}
253
+ ()
254
+ ⚡-call
255
+ @-data
256
+ #$%^&*()
257
+
258
+ Blank lines preserved!
259
+ } }
260
+ }
261
+ ```
262
+
263
+ The `escape{ }` block:
264
+ - Preserves all special characters literally
265
+ - Maintains whitespace and blank lines
266
+ - Handles nested braces correctly
267
+ - Perfect for code snippets, formulas, JSON
268
+
231
269
  ### Nesting
232
270
 
233
271
  ```markup
@@ -265,9 +303,15 @@ div {
265
303
  ### Backend Integration
266
304
 
267
305
  ```markup
306
+ // Using ⚡ symbol
268
307
  button(⚡-call: "selectPlan", data-plan: "starter") {
269
308
  Select Plan
270
309
  }
310
+
311
+ // Using @ alias (same functionality)
312
+ button(@-call: "selectPlan", data-plan: "starter") {
313
+ Select Plan
314
+ }
271
315
  ```
272
316
 
273
317
  This generates:
@@ -284,9 +328,15 @@ This generates:
284
328
  ### Dynamic Data Binding
285
329
 
286
330
  ```markup
331
+ // Using ⚡ symbol
287
332
  div(⚡-data: "userData") {
288
333
  p { User information }
289
334
  }
335
+
336
+ // Using @ alias
337
+ div(@-data: "userData") {
338
+ p { User information }
339
+ }
290
340
  ```
291
341
 
292
342
  In JavaScript, update it dynamically:
@@ -662,6 +712,66 @@ python cli.py input.HTMLXIFY output/ --verbose
662
712
  3. Upload HTML, CSS, JS to any web server
663
713
  4. Done! Your site is live 🚀
664
714
 
715
+ ## 🖥️ IDE Support (Language Server)
716
+
717
+ HTMLXIFY includes a **professional-grade Language Server Protocol (LSP)** implementation that works with any IDE:
718
+
719
+ ### Features (18+ LSP capabilities)
720
+
721
+ **Core Features:**
722
+ - ✅ Real-time error detection (parser diagnostics)
723
+ - ✅ Code completion (100+ HTML tags, attributes, escape blocks, snippets)
724
+ - ✅ Hover documentation (tags, @-call/@-data, escape blocks)
725
+ - ✅ Document outline/symbols (tags, IDs, classes hierarchy)
726
+ - ✅ Auto-formatting (smart indentation)
727
+
728
+ **Navigation:**
729
+ - ✅ Go-to-definition (jump to ID/class definitions)
730
+ - ✅ Find all references (locate all usages of ID/class)
731
+ - ✅ Workspace symbol search (Ctrl+T to find symbols across files)
732
+
733
+ **Editing:**
734
+ - ✅ Rename support (rename IDs/classes across document)
735
+ - ✅ Code actions (quick fixes for void elements, missing braces)
736
+ - ✅ Signature help (attribute hints while typing)
737
+ - ✅ Document highlight (highlight matching symbols)
738
+
739
+ **Code Intelligence:**
740
+ - ✅ Folding ranges (collapse/expand code blocks)
741
+ - ✅ Selection range (smart expand/shrink selection)
742
+ - ✅ Document links (clickable URLs in code)
743
+
744
+ ### VS Code Setup
745
+ ```json
746
+ // .vscode/settings.json
747
+ {
748
+ "htmlxify.languageServer.command": "htmlxify-lsp"
749
+ }
750
+ ```
751
+
752
+ ### Neovim Setup
753
+ ```lua
754
+ -- init.lua
755
+ require('lspconfig').htmlxify.setup{
756
+ cmd = { 'htmlxify-lsp' },
757
+ filetypes = { 'htmlx', 'htmlxify' },
758
+ }
759
+ ```
760
+
761
+ ### Other IDEs
762
+ The language server works with Sublime Text, Emacs, JetBrains IDEs, Helix, and any editor supporting LSP.
763
+
764
+ See `language_server/README.md` for detailed setup instructions.
765
+
766
+ ### Running the Server
767
+ ```bash
768
+ # After pip install
769
+ htmlxify-lsp
770
+
771
+ # Or directly
772
+ python -m language_server
773
+ ```
774
+
665
775
  ## 🎯 Next Steps
666
776
 
667
777
  After installing and creating your first file:
@@ -10,6 +10,7 @@ from pathlib import Path
10
10
 
11
11
  from htmlxify.parser.ast_builder import ASTBuilder
12
12
  from htmlxify.parser.indent_processor import IndentationProcessor
13
+ from htmlxify.parser.escape_preprocessor import EscapeBlockPreprocessor
13
14
  from htmlxify.validator.semantic import SemanticValidator
14
15
  from htmlxify.generators.html_gen import HTMLGenerator
15
16
  from htmlxify.generators.css_gen import CSSGenerator
@@ -52,37 +53,44 @@ def main():
52
53
  # Validate input file
53
54
  input_path = Path(args.input)
54
55
  if not input_path.exists():
55
- print(f"ERROR: File '{args.input}' not found")
56
+ print(f"❌ Error: File '{args.input}' not found")
56
57
  sys.exit(1)
57
58
 
58
- if input_path.suffix not in ['.htmlxify']:
59
- print(f"⚠️ Warning: File extension should be .htmlxify")
59
+ if input_path.suffix not in ['.htmlx', '.htmlxify']:
60
+ print(f"⚠️ Warning: File extension should be .htmlx or .htmlxify")
60
61
 
61
62
  # Read source
62
63
  try:
63
64
  source = input_path.read_text(encoding='utf-8')
64
65
  except Exception as e:
65
- print(f"ERROR: reading file: {e}")
66
+ print(f"❌ Error reading file: {e}")
66
67
  sys.exit(1)
67
68
 
68
- print(f"\nCompiling {input_path.name}...\n")
69
+ print(f"\n🔨 Compiling {input_path.name}...\n")
69
70
 
70
71
  try:
72
+ # Step 0: Preprocess escape blocks
73
+ escape_preprocessor = EscapeBlockPreprocessor()
74
+ processed_source = escape_preprocessor.preprocess(source)
75
+
71
76
  # Step 1: Parse
72
77
  if args.verbose:
73
- print("Step 1/6: Parsing...")
78
+ print("Step 1/7: Parsing...")
74
79
 
75
- ast_builder = ASTBuilder(source, input_path.name)
80
+ ast_builder = ASTBuilder(processed_source, input_path.name)
76
81
  ast = ast_builder.parse()
77
- print("OK - Parsing complete")
82
+ print("✓ Parsing complete")
83
+
84
+ # Step 1.5: Restore escape block content
85
+ ast = escape_preprocessor.restore_escape_content(ast)
78
86
 
79
87
  # Step 2: Process indentation
80
88
  if args.verbose:
81
- print("Step 2/6: Processing indentation...")
89
+ print("Step 2/7: Processing indentation...")
82
90
 
83
91
  indent_processor = IndentationProcessor()
84
92
  ast = indent_processor.process(ast)
85
- print("OK - Indentation processed")
93
+ print("✓ Indentation processed")
86
94
 
87
95
  # Step 3: Validate
88
96
  if args.verbose:
@@ -91,15 +99,11 @@ def main():
91
99
  validator = SemanticValidator(ast, input_path.name)
92
100
  if not validator.validate():
93
101
  sys.exit(1)
94
- print("OK - Validation complete")
95
-
96
- # Step 4: Create output directory (after validation passes)
97
- if args.verbose:
98
- print("Step 4/7: Creating output directory...")
102
+ print("✓ Validation complete")
99
103
 
104
+ # Step 4: Create output directory
100
105
  output_dir = Path(args.output)
101
106
  output_dir.mkdir(exist_ok=True, parents=True)
102
- print("OK - Output directory ready")
103
107
 
104
108
  # Step 5: Generate HTML
105
109
  if args.verbose:
@@ -108,22 +112,14 @@ def main():
108
112
  html_gen = HTMLGenerator(ast, input_path.name)
109
113
  html, source_map = html_gen.generate()
110
114
 
111
- html_path = output_dir / input_path.name.replace('.htmlxify', '.html')
112
- try:
113
- html_path.write_text(html, encoding='utf-8')
114
- except IOError as e:
115
- print(f"ERROR: Failed to write HTML file: {e}")
116
- sys.exit(1)
115
+ html_path = output_dir / input_path.name.replace('.htmlx', '.html').replace('.htmlxify', '.html')
116
+ html_path.write_text(html, encoding='utf-8')
117
117
 
118
118
  # Write source map
119
- source_map_path = output_dir / (input_path.name.replace('.htmlxify', '.html') + '.map')
120
- try:
121
- source_map_path.write_text(source_map, encoding='utf-8')
122
- except IOError as e:
123
- print(f"ERROR: Failed to write source map: {e}")
124
- sys.exit(1)
119
+ source_map_path = output_dir / (html_path.name + '.map')
120
+ source_map_path.write_text(source_map, encoding='utf-8')
125
121
 
126
- print(f"OK - Generated {html_path}")
122
+ print(f"✓ Generated {html_path}")
127
123
 
128
124
  # Step 6: Generate CSS
129
125
  if args.verbose:
@@ -132,13 +128,9 @@ def main():
132
128
  css_gen = CSSGenerator(ast)
133
129
  css = css_gen.generate()
134
130
 
135
- css_path = output_dir / input_path.name.replace('.htmlxify', '.css')
136
- try:
137
- css_path.write_text(css, encoding='utf-8')
138
- except IOError as e:
139
- print(f"ERROR: Failed to write CSS file: {e}")
140
- sys.exit(1)
141
- print(f"OK - Generated {css_path}")
131
+ css_path = output_dir / input_path.name.replace('.htmlx', '.css').replace('.htmlxify', '.css')
132
+ css_path.write_text(css, encoding='utf-8')
133
+ print(f"✓ Generated {css_path}")
142
134
 
143
135
  # Step 7: Generate JavaScript
144
136
  if args.verbose:
@@ -147,22 +139,18 @@ def main():
147
139
  js_gen = JSGenerator(ast)
148
140
  js = js_gen.generate()
149
141
 
150
- js_path = output_dir / input_path.name.replace('.htmlxify', '.js')
151
- try:
152
- js_path.write_text(js, encoding='utf-8')
153
- except IOError as e:
154
- print(f"ERROR: Failed to write JavaScript file: {e}")
155
- sys.exit(1)
156
- print(f"OK - Generated {js_path}")
142
+ js_path = output_dir / input_path.name.replace('.htmlx', '.js').replace('.htmlxify', '.js')
143
+ js_path.write_text(js, encoding='utf-8')
144
+ print(f"✓ Generated {js_path}")
157
145
 
158
- print("\nCompilation successful!\n")
146
+ print("\n✅ Compilation successful!\n")
159
147
 
160
148
  except KeyboardInterrupt:
161
- print("\n\nCompilation cancelled by user")
149
+ print("\n\n⚠️ Compilation cancelled by user")
162
150
  sys.exit(1)
163
151
 
164
152
  except Exception as e:
165
- print(f"\nCompilation failed: {e}")
153
+ print(f"\n❌ Compilation failed: {e}")
166
154
  if args.verbose:
167
155
  import traceback
168
156
  traceback.print_exc()
@@ -133,7 +133,8 @@ class HTMLGenerator:
133
133
  }
134
134
 
135
135
  for key, value in attrs.items():
136
- if key == '⚡-call':
136
+ # Handle both ⚡-call and @-call (alias)
137
+ if key == '⚡-call' or key == '@-call':
137
138
  # Backend API call - convert to data attribute
138
139
  if isinstance(value, dict):
139
140
  endpoint = value.get('endpoint', '')
@@ -143,7 +144,8 @@ class HTMLGenerator:
143
144
  safe_endpoint = html_escape_module.escape(endpoint, quote=True)
144
145
  self.output.append(f' data-api-call="{safe_endpoint}"')
145
146
 
146
- elif key == '⚡-data':
147
+ # Handle both ⚡-data and @-data (alias)
148
+ elif key == '⚡-data' or key == '@-data':
147
149
  # Dynamic data binding - mark for JS
148
150
  if isinstance(value, dict):
149
151
  data_key = value.get('key', '')
@@ -165,13 +167,17 @@ class HTMLGenerator:
165
167
  self.output.append(f' {safe_key}="{safe_value}"')
166
168
 
167
169
  def _generate_text(self, node: Dict[str, Any]):
168
- """Generate text node - ALWAYS ESCAPED"""
170
+ """Generate text node - escaped by default, raw if marked"""
169
171
  text = node.get('value', '')
170
172
 
171
- # SECURITY: Escape HTML entities to prevent XSS
172
- safe_text = html_escape_module.escape(text)
173
-
174
- self.output.append(safe_text)
173
+ # Check if this is raw content from escape block
174
+ if node.get('raw', False):
175
+ # Raw content - output as-is without escaping
176
+ self.output.append(text)
177
+ else:
178
+ # SECURITY: Escape HTML entities to prevent XSS
179
+ safe_text = html_escape_module.escape(text)
180
+ self.output.append(safe_text)
175
181
 
176
182
 
177
183
  # Test
@@ -165,6 +165,28 @@ class ASTTransformer(Transformer):
165
165
  """Alias for text_content inside body"""
166
166
  return children[0] if children else None
167
167
 
168
+ def body_escape(self, children: list) -> Dict[str, Any]:
169
+ """Alias for escape_block inside body"""
170
+ return children[0] if children else None
171
+
172
+ def body_comment(self, children: list) -> None:
173
+ """Comments in body are discarded"""
174
+ return None
175
+
176
+ def escape_block(self, children: list) -> Dict[str, Any]:
177
+ """
178
+ escape_block: "escape" "{" RAW_CONTENT "}"
179
+ Returns raw text node with unescaped content
180
+ """
181
+ if children:
182
+ raw_content = str(children[0])
183
+ return {
184
+ 'type': 'Text',
185
+ 'value': raw_content,
186
+ 'raw': True # Mark as raw/escaped content
187
+ }
188
+ return None
189
+
168
190
  def full_element(self, children: list) -> Dict[str, Any]:
169
191
  """
170
192
  full_element: WORD class_sel* id_sel? attributes? body
@@ -247,6 +269,10 @@ class ASTTransformer(Transformer):
247
269
  """Convert /) to literal )"""
248
270
  return ')'
249
271
 
272
+ def ESCAPE(self, token: Token) -> str:
273
+ """Escape keyword - just return the string"""
274
+ return str(token)
275
+
250
276
  def STRING(self, token: Token) -> str:
251
277
  """Remove quotes from strings"""
252
278
  s = str(token)
@@ -270,6 +296,14 @@ class ASTTransformer(Transformer):
270
296
  def COMMENT(self, token: Token) -> None:
271
297
  """Comments are discarded - return None"""
272
298
  return None
299
+
300
+ def RAW_CONTENT(self, token: Token) -> str:
301
+ """Raw content from escape blocks - return as-is"""
302
+ return str(token)
303
+
304
+ def SLASH(self, token: Token) -> str:
305
+ """Slash character - return as-is"""
306
+ return str(token)
273
307
 
274
308
 
275
309