htmlxify 1.0.0__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.
- {htmlxify-1.0.0 → htmlxify-1.0.2}/PKG-INFO +149 -12
- {htmlxify-1.0.0 → htmlxify-1.0.2}/README.md +148 -11
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/cli.py +33 -25
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/generators/html_gen.py +45 -9
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/parser/ast_builder.py +68 -4
- htmlxify-1.0.2/htmlxify/parser/escape_preprocessor.py +146 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/parser/grammar.lark +27 -11
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/validator/semantic.py +60 -8
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify.egg-info/PKG-INFO +149 -12
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify.egg-info/SOURCES.txt +5 -1
- htmlxify-1.0.2/htmlxify.egg-info/entry_points.txt +3 -0
- htmlxify-1.0.2/htmlxify.egg-info/top_level.txt +2 -0
- htmlxify-1.0.2/language_server/__init__.py +25 -0
- htmlxify-1.0.2/language_server/__main__.py +12 -0
- htmlxify-1.0.2/language_server/server.py +1304 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/setup.py +9 -1
- htmlxify-1.0.0/htmlxify.egg-info/entry_points.txt +0 -2
- htmlxify-1.0.0/htmlxify.egg-info/top_level.txt +0 -1
- {htmlxify-1.0.0 → htmlxify-1.0.2}/LICENSE +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/__init__.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/generators/__init__.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/generators/css_gen.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/generators/js_gen.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/parser/__init__.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/parser/indent_processor.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/utils/__init__.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify/validator/__init__.py +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify.egg-info/dependency_links.txt +0 -0
- {htmlxify-1.0.0 → htmlxify-1.0.2}/htmlxify.egg-info/requires.txt +0 -0
- {htmlxify-1.0.0 → 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.
|
|
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
|
|
@@ -134,6 +134,12 @@ HTMLXIFY page.HTMLXIFY output/
|
|
|
134
134
|
- ✅ **XSS Protection** - Automatic HTML escaping for security
|
|
135
135
|
- ✅ **Fast Compilation** - Single-pass compiler, instant results
|
|
136
136
|
- ✅ **Production Ready** - Generates clean, optimized code
|
|
137
|
+
- ✅ **Void Elements** - Proper `<br>`, `<img>`, `<input>`, `<meta>`, etc. handling
|
|
138
|
+
- ✅ **Escape Sequences** - Support for `/{`, `/}`, `/(`, `/)`
|
|
139
|
+
- ✅ **Escape Blocks** - Raw content with `escape{ }` preserving braces, parentheses
|
|
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.)
|
|
137
143
|
|
|
138
144
|
## 📋 Implementation Status
|
|
139
145
|
|
|
@@ -145,19 +151,19 @@ HTMLXIFY page.HTMLXIFY output/
|
|
|
145
151
|
| **JavaScript Generator** | ✅ Complete (10.6 KB with API handlers) |
|
|
146
152
|
| **CLI Tool** | ✅ Complete & tested |
|
|
147
153
|
| **Standalone Executable** | ✅ Built for distribution (PyPI package) |
|
|
148
|
-
| **Backend Integration** | ✅ Complete (API calls with ⚡-call) |
|
|
154
|
+
| **Backend Integration** | ✅ Complete (API calls with ⚡-call / @-call) |
|
|
149
155
|
| **Semantic Validator** | ✅ Complete |
|
|
150
|
-
| **
|
|
151
|
-
| **Language Server** |
|
|
156
|
+
| **Escape Blocks** | ✅ Complete (raw content with braces, parens) |
|
|
157
|
+
| **Language Server (LSP)** | ✅ Complete (works with all IDEs) |
|
|
152
158
|
|
|
153
159
|
## 🚀 Quick Start
|
|
154
160
|
|
|
155
161
|
### Installation
|
|
156
162
|
|
|
157
|
-
**Option 1: Install from
|
|
163
|
+
**Option 1: Install from PyPI (Recommended)**
|
|
158
164
|
|
|
159
165
|
```bash
|
|
160
|
-
pip install
|
|
166
|
+
pip install htmlxify
|
|
161
167
|
```
|
|
162
168
|
|
|
163
169
|
Then use the command:
|
|
@@ -221,7 +227,9 @@ This generates:
|
|
|
221
227
|
|
|
222
228
|
Open `output/hello.html` in your browser and you're done! 🎉
|
|
223
229
|
|
|
224
|
-
**That's it!** No configuration, no build tools. Just HTML, CSS, and JS
|
|
230
|
+
**That's it!** No configuration, no build tools. Just HTML, CSS, and JS.
|
|
231
|
+
|
|
232
|
+
## 📖 Language Syntax Guide
|
|
225
233
|
|
|
226
234
|
### Basic Elements
|
|
227
235
|
|
|
@@ -231,6 +239,12 @@ div { Content }
|
|
|
231
239
|
p { Paragraph }
|
|
232
240
|
h1 { Heading }
|
|
233
241
|
button { Click Me }
|
|
242
|
+
|
|
243
|
+
// Void elements (no closing tag)
|
|
244
|
+
br
|
|
245
|
+
img(src: "photo.jpg", alt: "Photo")
|
|
246
|
+
input(type: "text")
|
|
247
|
+
meta(charset: "UTF-8")
|
|
234
248
|
```
|
|
235
249
|
|
|
236
250
|
### Classes & IDs
|
|
@@ -252,16 +266,67 @@ div.card#featured { ... }
|
|
|
252
266
|
### Attributes
|
|
253
267
|
|
|
254
268
|
```markup
|
|
255
|
-
//
|
|
269
|
+
// String attributes
|
|
256
270
|
button(onclick: "handleClick") { Click }
|
|
271
|
+
a(href: "https://example.com", target: "_blank") { Link }
|
|
257
272
|
|
|
258
|
-
//
|
|
259
|
-
input(type: "
|
|
273
|
+
// Boolean attributes (no value)
|
|
274
|
+
input(type: "checkbox", checked)
|
|
275
|
+
input(type: "text", disabled)
|
|
276
|
+
button(disabled) { Can't Click }
|
|
277
|
+
form(novalidate) { ... }
|
|
278
|
+
```
|
|
260
279
|
|
|
261
|
-
|
|
262
|
-
|
|
280
|
+
### Escape Sequences
|
|
281
|
+
|
|
282
|
+
When you need characters that conflict with syntax, use escape sequences:
|
|
283
|
+
|
|
284
|
+
```markup
|
|
285
|
+
// Escaped curly braces
|
|
286
|
+
p { JSON: /{ "key": "value" /} }
|
|
287
|
+
|
|
288
|
+
// Escaped parentheses
|
|
289
|
+
code { function/(/)/() /{ return true; /} }
|
|
290
|
+
|
|
291
|
+
// Real-world example
|
|
292
|
+
p { Price: $99.99 (50% off) and formula: x^2 }
|
|
263
293
|
```
|
|
264
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
|
+
|
|
265
330
|
### Nesting
|
|
266
331
|
|
|
267
332
|
```markup
|
|
@@ -299,9 +364,15 @@ div {
|
|
|
299
364
|
### Backend Integration
|
|
300
365
|
|
|
301
366
|
```markup
|
|
367
|
+
// Using ⚡ symbol
|
|
302
368
|
button(⚡-call: "selectPlan", data-plan: "starter") {
|
|
303
369
|
Select Plan
|
|
304
370
|
}
|
|
371
|
+
|
|
372
|
+
// Using @ alias (same functionality)
|
|
373
|
+
button(@-call: "selectPlan", data-plan: "starter") {
|
|
374
|
+
Select Plan
|
|
375
|
+
}
|
|
305
376
|
```
|
|
306
377
|
|
|
307
378
|
This generates:
|
|
@@ -318,9 +389,15 @@ This generates:
|
|
|
318
389
|
### Dynamic Data Binding
|
|
319
390
|
|
|
320
391
|
```markup
|
|
392
|
+
// Using ⚡ symbol
|
|
321
393
|
div(⚡-data: "userData") {
|
|
322
394
|
p { User information }
|
|
323
395
|
}
|
|
396
|
+
|
|
397
|
+
// Using @ alias
|
|
398
|
+
div(@-data: "userData") {
|
|
399
|
+
p { User information }
|
|
400
|
+
}
|
|
324
401
|
```
|
|
325
402
|
|
|
326
403
|
In JavaScript, update it dynamically:
|
|
@@ -696,6 +773,66 @@ python cli.py input.HTMLXIFY output/ --verbose
|
|
|
696
773
|
3. Upload HTML, CSS, JS to any web server
|
|
697
774
|
4. Done! Your site is live 🚀
|
|
698
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
|
+
|
|
699
836
|
## 🎯 Next Steps
|
|
700
837
|
|
|
701
838
|
After installing and creating your first file:
|
|
@@ -73,6 +73,12 @@ HTMLXIFY page.HTMLXIFY output/
|
|
|
73
73
|
- ✅ **XSS Protection** - Automatic HTML escaping for security
|
|
74
74
|
- ✅ **Fast Compilation** - Single-pass compiler, instant results
|
|
75
75
|
- ✅ **Production Ready** - Generates clean, optimized code
|
|
76
|
+
- ✅ **Void Elements** - Proper `<br>`, `<img>`, `<input>`, `<meta>`, etc. handling
|
|
77
|
+
- ✅ **Escape Sequences** - Support for `/{`, `/}`, `/(`, `/)`
|
|
78
|
+
- ✅ **Escape Blocks** - Raw content with `escape{ }` preserving braces, parentheses
|
|
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.)
|
|
76
82
|
|
|
77
83
|
## 📋 Implementation Status
|
|
78
84
|
|
|
@@ -84,19 +90,19 @@ HTMLXIFY page.HTMLXIFY output/
|
|
|
84
90
|
| **JavaScript Generator** | ✅ Complete (10.6 KB with API handlers) |
|
|
85
91
|
| **CLI Tool** | ✅ Complete & tested |
|
|
86
92
|
| **Standalone Executable** | ✅ Built for distribution (PyPI package) |
|
|
87
|
-
| **Backend Integration** | ✅ Complete (API calls with ⚡-call) |
|
|
93
|
+
| **Backend Integration** | ✅ Complete (API calls with ⚡-call / @-call) |
|
|
88
94
|
| **Semantic Validator** | ✅ Complete |
|
|
89
|
-
| **
|
|
90
|
-
| **Language Server** |
|
|
95
|
+
| **Escape Blocks** | ✅ Complete (raw content with braces, parens) |
|
|
96
|
+
| **Language Server (LSP)** | ✅ Complete (works with all IDEs) |
|
|
91
97
|
|
|
92
98
|
## 🚀 Quick Start
|
|
93
99
|
|
|
94
100
|
### Installation
|
|
95
101
|
|
|
96
|
-
**Option 1: Install from
|
|
102
|
+
**Option 1: Install from PyPI (Recommended)**
|
|
97
103
|
|
|
98
104
|
```bash
|
|
99
|
-
pip install
|
|
105
|
+
pip install htmlxify
|
|
100
106
|
```
|
|
101
107
|
|
|
102
108
|
Then use the command:
|
|
@@ -160,7 +166,9 @@ This generates:
|
|
|
160
166
|
|
|
161
167
|
Open `output/hello.html` in your browser and you're done! 🎉
|
|
162
168
|
|
|
163
|
-
**That's it!** No configuration, no build tools. Just HTML, CSS, and JS
|
|
169
|
+
**That's it!** No configuration, no build tools. Just HTML, CSS, and JS.
|
|
170
|
+
|
|
171
|
+
## 📖 Language Syntax Guide
|
|
164
172
|
|
|
165
173
|
### Basic Elements
|
|
166
174
|
|
|
@@ -170,6 +178,12 @@ div { Content }
|
|
|
170
178
|
p { Paragraph }
|
|
171
179
|
h1 { Heading }
|
|
172
180
|
button { Click Me }
|
|
181
|
+
|
|
182
|
+
// Void elements (no closing tag)
|
|
183
|
+
br
|
|
184
|
+
img(src: "photo.jpg", alt: "Photo")
|
|
185
|
+
input(type: "text")
|
|
186
|
+
meta(charset: "UTF-8")
|
|
173
187
|
```
|
|
174
188
|
|
|
175
189
|
### Classes & IDs
|
|
@@ -191,16 +205,67 @@ div.card#featured { ... }
|
|
|
191
205
|
### Attributes
|
|
192
206
|
|
|
193
207
|
```markup
|
|
194
|
-
//
|
|
208
|
+
// String attributes
|
|
195
209
|
button(onclick: "handleClick") { Click }
|
|
210
|
+
a(href: "https://example.com", target: "_blank") { Link }
|
|
196
211
|
|
|
197
|
-
//
|
|
198
|
-
input(type: "
|
|
212
|
+
// Boolean attributes (no value)
|
|
213
|
+
input(type: "checkbox", checked)
|
|
214
|
+
input(type: "text", disabled)
|
|
215
|
+
button(disabled) { Can't Click }
|
|
216
|
+
form(novalidate) { ... }
|
|
217
|
+
```
|
|
199
218
|
|
|
200
|
-
|
|
201
|
-
|
|
219
|
+
### Escape Sequences
|
|
220
|
+
|
|
221
|
+
When you need characters that conflict with syntax, use escape sequences:
|
|
222
|
+
|
|
223
|
+
```markup
|
|
224
|
+
// Escaped curly braces
|
|
225
|
+
p { JSON: /{ "key": "value" /} }
|
|
226
|
+
|
|
227
|
+
// Escaped parentheses
|
|
228
|
+
code { function/(/)/() /{ return true; /} }
|
|
229
|
+
|
|
230
|
+
// Real-world example
|
|
231
|
+
p { Price: $99.99 (50% off) and formula: x^2 }
|
|
202
232
|
```
|
|
203
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
|
+
|
|
204
269
|
### Nesting
|
|
205
270
|
|
|
206
271
|
```markup
|
|
@@ -238,9 +303,15 @@ div {
|
|
|
238
303
|
### Backend Integration
|
|
239
304
|
|
|
240
305
|
```markup
|
|
306
|
+
// Using ⚡ symbol
|
|
241
307
|
button(⚡-call: "selectPlan", data-plan: "starter") {
|
|
242
308
|
Select Plan
|
|
243
309
|
}
|
|
310
|
+
|
|
311
|
+
// Using @ alias (same functionality)
|
|
312
|
+
button(@-call: "selectPlan", data-plan: "starter") {
|
|
313
|
+
Select Plan
|
|
314
|
+
}
|
|
244
315
|
```
|
|
245
316
|
|
|
246
317
|
This generates:
|
|
@@ -257,9 +328,15 @@ This generates:
|
|
|
257
328
|
### Dynamic Data Binding
|
|
258
329
|
|
|
259
330
|
```markup
|
|
331
|
+
// Using ⚡ symbol
|
|
260
332
|
div(⚡-data: "userData") {
|
|
261
333
|
p { User information }
|
|
262
334
|
}
|
|
335
|
+
|
|
336
|
+
// Using @ alias
|
|
337
|
+
div(@-data: "userData") {
|
|
338
|
+
p { User information }
|
|
339
|
+
}
|
|
263
340
|
```
|
|
264
341
|
|
|
265
342
|
In JavaScript, update it dynamically:
|
|
@@ -635,6 +712,66 @@ python cli.py input.HTMLXIFY output/ --verbose
|
|
|
635
712
|
3. Upload HTML, CSS, JS to any web server
|
|
636
713
|
4. Done! Your site is live 🚀
|
|
637
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
|
+
|
|
638
775
|
## 🎯 Next Steps
|
|
639
776
|
|
|
640
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,46 +53,53 @@ def main():
|
|
|
52
53
|
# Validate input file
|
|
53
54
|
input_path = Path(args.input)
|
|
54
55
|
if not input_path.exists():
|
|
55
|
-
print(f"
|
|
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"
|
|
66
|
+
print(f"❌ Error reading file: {e}")
|
|
66
67
|
sys.exit(1)
|
|
67
68
|
|
|
68
|
-
print(f"\
|
|
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/
|
|
78
|
+
print("Step 1/7: Parsing...")
|
|
74
79
|
|
|
75
|
-
ast_builder = ASTBuilder(
|
|
80
|
+
ast_builder = ASTBuilder(processed_source, input_path.name)
|
|
76
81
|
ast = ast_builder.parse()
|
|
77
|
-
print("
|
|
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/
|
|
89
|
+
print("Step 2/7: Processing indentation...")
|
|
82
90
|
|
|
83
91
|
indent_processor = IndentationProcessor()
|
|
84
92
|
ast = indent_processor.process(ast)
|
|
85
|
-
print("
|
|
93
|
+
print("✓ Indentation processed")
|
|
86
94
|
|
|
87
95
|
# Step 3: Validate
|
|
88
96
|
if args.verbose:
|
|
89
|
-
print("Step 3/
|
|
97
|
+
print("Step 3/7: Validating...")
|
|
90
98
|
|
|
91
99
|
validator = SemanticValidator(ast, input_path.name)
|
|
92
100
|
if not validator.validate():
|
|
93
101
|
sys.exit(1)
|
|
94
|
-
print("
|
|
102
|
+
print("✓ Validation complete")
|
|
95
103
|
|
|
96
104
|
# Step 4: Create output directory
|
|
97
105
|
output_dir = Path(args.output)
|
|
@@ -99,50 +107,50 @@ def main():
|
|
|
99
107
|
|
|
100
108
|
# Step 5: Generate HTML
|
|
101
109
|
if args.verbose:
|
|
102
|
-
print("Step
|
|
110
|
+
print("Step 5/7: Generating HTML...")
|
|
103
111
|
|
|
104
112
|
html_gen = HTMLGenerator(ast, input_path.name)
|
|
105
113
|
html, source_map = html_gen.generate()
|
|
106
114
|
|
|
107
|
-
html_path = output_dir / input_path.name.replace('.htmlxify', '.html')
|
|
115
|
+
html_path = output_dir / input_path.name.replace('.htmlx', '.html').replace('.htmlxify', '.html')
|
|
108
116
|
html_path.write_text(html, encoding='utf-8')
|
|
109
117
|
|
|
110
118
|
# Write source map
|
|
111
|
-
source_map_path = output_dir / (
|
|
119
|
+
source_map_path = output_dir / (html_path.name + '.map')
|
|
112
120
|
source_map_path.write_text(source_map, encoding='utf-8')
|
|
113
121
|
|
|
114
|
-
print(f"
|
|
122
|
+
print(f"✓ Generated {html_path}")
|
|
115
123
|
|
|
116
124
|
# Step 6: Generate CSS
|
|
117
125
|
if args.verbose:
|
|
118
|
-
print("Step
|
|
126
|
+
print("Step 6/7: Generating CSS...")
|
|
119
127
|
|
|
120
128
|
css_gen = CSSGenerator(ast)
|
|
121
129
|
css = css_gen.generate()
|
|
122
130
|
|
|
123
|
-
css_path = output_dir / input_path.name.replace('.htmlxify', '.css')
|
|
131
|
+
css_path = output_dir / input_path.name.replace('.htmlx', '.css').replace('.htmlxify', '.css')
|
|
124
132
|
css_path.write_text(css, encoding='utf-8')
|
|
125
|
-
print(f"
|
|
133
|
+
print(f"✓ Generated {css_path}")
|
|
126
134
|
|
|
127
135
|
# Step 7: Generate JavaScript
|
|
128
136
|
if args.verbose:
|
|
129
|
-
print("Step
|
|
137
|
+
print("Step 7/7: Generating JavaScript...")
|
|
130
138
|
|
|
131
139
|
js_gen = JSGenerator(ast)
|
|
132
140
|
js = js_gen.generate()
|
|
133
141
|
|
|
134
|
-
js_path = output_dir / input_path.name.replace('.htmlxify', '.js')
|
|
142
|
+
js_path = output_dir / input_path.name.replace('.htmlx', '.js').replace('.htmlxify', '.js')
|
|
135
143
|
js_path.write_text(js, encoding='utf-8')
|
|
136
|
-
print(f"
|
|
144
|
+
print(f"✓ Generated {js_path}")
|
|
137
145
|
|
|
138
|
-
print("\
|
|
146
|
+
print("\n✅ Compilation successful!\n")
|
|
139
147
|
|
|
140
148
|
except KeyboardInterrupt:
|
|
141
|
-
print("\n\
|
|
149
|
+
print("\n\n⚠️ Compilation cancelled by user")
|
|
142
150
|
sys.exit(1)
|
|
143
151
|
|
|
144
152
|
except Exception as e:
|
|
145
|
-
print(f"\
|
|
153
|
+
print(f"\n❌ Compilation failed: {e}")
|
|
146
154
|
if args.verbose:
|
|
147
155
|
import traceback
|
|
148
156
|
traceback.print_exc()
|