thoth-markup-lang 1.0.2 → 3.0.0
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.
- package/.htaccess +3 -0
- package/README.md +30 -9
- package/package.json +4 -4
- package/thoth-server.php +8 -0
- package/thoth.js +61 -97
- package/index.html +0 -22
- package/index.thoth +0 -13
- package/test.html +0 -76
- package/test.thoth +0 -67
package/.htaccess
ADDED
package/README.md
CHANGED
|
@@ -1,21 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# <p align="center">𓅓 THOTH: The Pure Dynasty Edition</p>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://img.shields.io/npm/v/thoth-markup-lang?style=for-the-badge&color=D4AF37&logo=npm" alt="NPM Version" />
|
|
5
|
+
<img src="https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge" alt="Maintained" />
|
|
6
|
+
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge" alt="License" />
|
|
7
|
+
<img src="https://img.shields.io/badge/Built%20In-Egypt%20🇪🇬-orange?style=for-the-badge" alt="Egypt" />
|
|
8
|
+
</p>
|
|
4
9
|
|
|
5
|
-
|
|
6
|
-
|
|
10
|
+
<p align="center">
|
|
11
|
+
<strong>The Pythonic Architect of the Web.</strong><br />
|
|
12
|
+
Write clean, indentation-based markup that compiles instantly into standard HTML5. <br />
|
|
13
|
+
Stop writing brackets. Start writing wisdom.
|
|
14
|
+
</p>
|
|
7
15
|
|
|
8
|
-
|
|
9
|
-
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 🏛️ What is THOTH?
|
|
19
|
+
|
|
20
|
+
**THOTH** is a revolutionary markup engine that eliminates the clutter of traditional HTML. By adopting a **Python-like indentation system**, it allows developers to build complex web structures with absolute visual clarity.
|
|
21
|
+
|
|
22
|
+
Named after the Egyptian God of Wisdom and Writing, THOTH v3.0 represents a new era where the developer only cares about the structure, leaving the messy `< >` brackets behind.
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## ✨ Key Features
|
|
10
27
|
|
|
11
|
-
|
|
12
|
-
|
|
28
|
+
* **💎 Zero-Bracket Architecture:** No more opening or closing tags.
|
|
29
|
+
* **🐍 Pythonic Logic:** Structure is defined by indentation (spaces/tabs).
|
|
30
|
+
* **⚡ High-Performance Compiler:** Blazing fast compilation from `.thoth` to `.html`.
|
|
31
|
+
* **💉 Raw Code Injection:** Native blocks for `StyleSheet` (CSS) and `Scripting` (JS).
|
|
32
|
+
* **🌍 Universal Runtime:** Run `.thoth` files directly on your server via the THOTH Server Engine.
|
|
33
|
+
* **🛡️ HTML5 Semantic Purity:** 100% support for all modern HTML5 tags and attributes.
|
|
13
34
|
|
|
14
35
|
---
|
|
15
36
|
|
|
16
37
|
## 🚀 Installation
|
|
17
38
|
|
|
18
|
-
Install THOTH globally
|
|
39
|
+
Install the THOTH CLI globally via NPM:
|
|
19
40
|
|
|
20
41
|
```bash
|
|
21
42
|
npm install -g thoth-markup-lang
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thoth-markup-lang",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "3.0.0",
|
|
4
|
+
"description": "Pure Indentation-Based Markup Language by Abdelfatah Abdelhamed",
|
|
5
5
|
"main": "thoth.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"thoth": "./thoth.js"
|
|
8
8
|
},
|
|
9
|
-
"keywords": ["
|
|
10
|
-
"author": "Abdelfatah Abdelhamed",
|
|
9
|
+
"keywords": ["thoth", "no-html", "markup", "egyptian", "clean-code"],
|
|
10
|
+
"author": "Abdelfatah Abdelhamed (Egypt)",
|
|
11
11
|
"license": "MIT"
|
|
12
12
|
}
|
package/thoth-server.php
ADDED
package/thoth.js
CHANGED
|
@@ -1,111 +1,75 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* THOTH Engine v3.0.0 - "Pure Dynasty Edition"
|
|
4
|
+
* Lead Developer: Abdelfatah Abdelhamed 🇪🇬
|
|
5
|
+
*/
|
|
2
6
|
|
|
3
7
|
const fs = require('fs');
|
|
4
8
|
const path = require('path');
|
|
5
9
|
|
|
6
|
-
const
|
|
10
|
+
const command = process.argv[2];
|
|
11
|
+
const file = process.argv[3];
|
|
7
12
|
|
|
8
|
-
if (!
|
|
9
|
-
console.
|
|
10
|
-
console.log('💡 Usage: thoth filename.thoth');
|
|
13
|
+
if (!command || (command !== 'build' && !command.endsWith('.thoth'))) {
|
|
14
|
+
console.log('\x1b[33m%s\x1b[0m', 'Usage: \n thoth build file.thoth (To create HTML)\n thoth file.thoth (Quick Compile)');
|
|
11
15
|
process.exit(1);
|
|
12
16
|
}
|
|
13
17
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
'
|
|
20
|
-
'
|
|
18
|
+
const targetFile = command === 'build' ? file : command;
|
|
19
|
+
|
|
20
|
+
// القاموس الشامل للمحرك
|
|
21
|
+
const MAP = {
|
|
22
|
+
'Title': 'h1', 'Sub': 'h2', 'Text': 'p', 'Box': 'div', 'Section': 'section',
|
|
23
|
+
'Nav': 'nav', 'Header': 'header', 'Footer': 'footer', 'Bold': 'strong',
|
|
24
|
+
'Link': 'a', 'Image': 'img', 'Button': 'button', 'List': 'ul', 'Item': 'li',
|
|
25
|
+
'Input': 'input', 'Form': 'form', 'Label': 'label', 'Break': 'br'
|
|
21
26
|
};
|
|
22
27
|
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
let
|
|
29
|
-
let stack = [];
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// لو إحنا جوه كود CSS أو JS والمسافات رجعت لورا، نقفل التاج
|
|
43
|
-
if (inRawMode && indent <= rawIndentLevel) {
|
|
44
|
-
inRawMode = false;
|
|
45
|
-
html += ' '.repeat(rawIndentLevel) + `</${rawTagName}>\n`;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// لو إحنا جوه كود CSS أو JS، اطبع السطر زي ما هو من غير تعديل
|
|
49
|
-
if (inRawMode) {
|
|
50
|
-
html += line + '\n';
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const match = contentRaw.match(/^([A-Za-z0-9]+)([^:]*):?(.*)$/);
|
|
55
|
-
if (!match) return;
|
|
56
|
-
|
|
57
|
-
let command = match[1].trim();
|
|
58
|
-
let attributes = match[2].trim();
|
|
59
|
-
let content = match[3].trim();
|
|
60
|
-
|
|
61
|
-
let htmlTag = tagAliases[command] || command.toLowerCase();
|
|
62
|
-
|
|
63
|
-
while (stack.length > 0 && stack[stack.length - 1].indent >= indent) {
|
|
64
|
-
html += ' '.repeat(stack[stack.length - 1].indent) + `</${stack.pop().name}>\n`;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// أوامر الربط السريع للملفات الخارجية
|
|
68
|
-
if (command === 'IncludeCss') {
|
|
69
|
-
html += ' '.repeat(indent) + `<link rel="stylesheet" href="${content}">\n`;
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
if (command === 'IncludeJs') {
|
|
73
|
-
html += ' '.repeat(indent) + `<script src="${content}"></script>\n`;
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
let openTag = `<${htmlTag}${attributes ? ' ' + attributes : ''}>`;
|
|
78
|
-
|
|
79
|
-
// الدخول في وضع الـ Raw Mode لو الأمر Style أو Script
|
|
80
|
-
if ((htmlTag === 'style' || htmlTag === 'script') && !content) {
|
|
81
|
-
inRawMode = true;
|
|
82
|
-
rawIndentLevel = indent;
|
|
83
|
-
rawTagName = htmlTag;
|
|
84
|
-
html += ' '.repeat(indent) + openTag + '\n';
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (voidTags.includes(htmlTag)) {
|
|
89
|
-
html += ' '.repeat(indent) + openTag + '\n';
|
|
90
|
-
} else if (content) {
|
|
91
|
-
html += ' '.repeat(indent) + openTag + content + `</${htmlTag}>\n`;
|
|
92
|
-
} else {
|
|
93
|
-
html += ' '.repeat(indent) + openTag + '\n';
|
|
94
|
-
stack.push({ name: htmlTag, indent: indent });
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
// إغلاق أي أكواد مفتوحة في نهاية الملف
|
|
99
|
-
if (inRawMode) {
|
|
100
|
-
html += ' '.repeat(rawIndentLevel) + `</${rawTagName}>\n`;
|
|
101
|
-
}
|
|
102
|
-
while (stack.length > 0) {
|
|
103
|
-
html += ' '.repeat(stack[stack.length - 1].indent) + `</${stack.pop().name}>\n`;
|
|
104
|
-
}
|
|
28
|
+
const VOID = ['img', 'br', 'hr', 'input', 'meta', 'link'];
|
|
29
|
+
|
|
30
|
+
function compile(filePath) {
|
|
31
|
+
const code = fs.readFileSync(filePath, 'utf8');
|
|
32
|
+
const lines = code.split(/\r?\n/);
|
|
33
|
+
let htmlBody = "";
|
|
34
|
+
let stack = [];
|
|
35
|
+
let inRaw = false, rawType = '', rawIndent = 0;
|
|
36
|
+
|
|
37
|
+
lines.forEach(line => {
|
|
38
|
+
if (!line.trim() || line.trim().startsWith('#')) return;
|
|
39
|
+
const indent = line.search(/\S/);
|
|
40
|
+
const clean = line.trim();
|
|
41
|
+
|
|
42
|
+
if (inRaw) {
|
|
43
|
+
if (indent <= rawIndent && clean !== "") { inRaw = false; htmlBody += `</${rawType}>\n`; }
|
|
44
|
+
else { htmlBody += line + '\n'; return; }
|
|
45
|
+
}
|
|
105
46
|
|
|
106
|
-
|
|
47
|
+
const match = clean.match(/^([A-Za-z0-9]+)([^:]*):?(.*)$/);
|
|
48
|
+
if (!match) return;
|
|
49
|
+
let [_, cmd, attrs, val] = match;
|
|
107
50
|
|
|
108
|
-
|
|
109
|
-
|
|
51
|
+
if (cmd === "StyleSheet" || cmd === "Scripting") {
|
|
52
|
+
inRaw = true; rawType = (cmd === "StyleSheet") ? "style" : "script";
|
|
53
|
+
rawIndent = indent; htmlBody += `<${rawType}>\n`; return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
while (stack.length > 0 && stack[stack.length - 1].indent >= indent) {
|
|
57
|
+
htmlBody += `</${stack.pop().name}>\n`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let tag = MAP[cmd] || cmd.toLowerCase();
|
|
61
|
+
let open = `<${tag}${attrs.trim() ? ' ' + attrs.trim() : ''}>`;
|
|
62
|
+
|
|
63
|
+
if (VOID.includes(tag)) htmlBody += open + '\n';
|
|
64
|
+
else if (val.trim()) htmlBody += `${open}${val.trim()}</${tag}>\n`;
|
|
65
|
+
else { htmlBody += open + '\n'; stack.push({ name: tag, indent: indent }); }
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
while (stack.length > 0) htmlBody += `</${stack.pop().name}>\n`;
|
|
69
|
+
return `<!DOCTYPE html><html><head><meta charset="UTF-8"><title>THOTH Pure Web</title></head><body>${htmlBody}</body></html>`;
|
|
70
|
+
}
|
|
110
71
|
|
|
111
|
-
|
|
72
|
+
const result = compile(targetFile);
|
|
73
|
+
const output = targetFile.replace('.thoth', '.html');
|
|
74
|
+
fs.writeFileSync(output, result);
|
|
75
|
+
console.log('\x1b[32m%s\x1b[0m', `✔ THOTH v3.0: Generated Successfully [By Abdelfatah Abdelhamed]`);
|
package/index.html
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>THOTH Output</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1 style="color>#d4af37; text-align: center;": Welcome to THOTH</h1>
|
|
10
|
-
<p>This is a clean alternative to HTML.</p>
|
|
11
|
-
<div class="container">
|
|
12
|
-
<h2>Why use it?</h2>
|
|
13
|
-
<ul>
|
|
14
|
-
<li>No closing tags</li>
|
|
15
|
-
<li>Pythonic indentation</li>
|
|
16
|
-
<li>Full HTML support</li>
|
|
17
|
-
</ul>
|
|
18
|
-
<br>
|
|
19
|
-
<button onclick="alert('Hello!')">Click Me</button>
|
|
20
|
-
</div>
|
|
21
|
-
</body>
|
|
22
|
-
</html>
|
package/index.thoth
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
Title style="color: #d4af37; text-align: center;": Welcome to THOTH
|
|
2
|
-
Text: This is a clean alternative to HTML.
|
|
3
|
-
|
|
4
|
-
Box class="container":
|
|
5
|
-
Sub: Why use it?
|
|
6
|
-
List:
|
|
7
|
-
Item: No closing tags
|
|
8
|
-
Item: Pythonic indentation
|
|
9
|
-
Item: Full HTML support
|
|
10
|
-
|
|
11
|
-
Break:
|
|
12
|
-
|
|
13
|
-
Button onclick="alert('Hello!')": Click Me
|
package/test.html
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<title>THOTH Web App</title>
|
|
7
|
-
</head>
|
|
8
|
-
<body>
|
|
9
|
-
<h1 style="color>#d4af37; text-align: center;": Welcome to THOTH V2</h1>
|
|
10
|
-
<p>Now supporting EVERY HTML element with attributes!</p>
|
|
11
|
-
<div style="border>2px dashed #d4af37; padding: 20px; border-radius: 8px;":</div>
|
|
12
|
-
<h2>1. Full Form Support</h2>
|
|
13
|
-
<form>
|
|
14
|
-
<label>Enter your Name:</label>
|
|
15
|
-
<input type="text" placeholder="John Doe">
|
|
16
|
-
<br>
|
|
17
|
-
<label>Choose an option:</label>
|
|
18
|
-
<select>
|
|
19
|
-
<option value="1">Option A</option>
|
|
20
|
-
<option value="2">Option B</option>
|
|
21
|
-
</select>
|
|
22
|
-
<br>
|
|
23
|
-
<button type="button">Submit Data</button>
|
|
24
|
-
</form>
|
|
25
|
-
<hr>
|
|
26
|
-
<h2>2. Tables and Data</h2>
|
|
27
|
-
<table>
|
|
28
|
-
<tr>
|
|
29
|
-
<th>ID</th>
|
|
30
|
-
<th>Name</th>
|
|
31
|
-
<th>Role</th>
|
|
32
|
-
</tr>
|
|
33
|
-
<tr>
|
|
34
|
-
<td>1</td>
|
|
35
|
-
<td>Thoth</td>
|
|
36
|
-
<td>Scribe</td>
|
|
37
|
-
</tr>
|
|
38
|
-
<tr>
|
|
39
|
-
<td>2</td>
|
|
40
|
-
<td>Horus</td>
|
|
41
|
-
<td>Guardian</td>
|
|
42
|
-
</tr>
|
|
43
|
-
</table>
|
|
44
|
-
<hr>
|
|
45
|
-
<h2>3. Lists</h2>
|
|
46
|
-
<ol>
|
|
47
|
-
<li>Clean Syntax</li>
|
|
48
|
-
<li>Python-like Indentation</li>
|
|
49
|
-
<li>Ultimate Power</li>
|
|
50
|
-
</ol>
|
|
51
|
-
<link rel="stylesheet" href="style.css">
|
|
52
|
-
<style>
|
|
53
|
-
body {
|
|
54
|
-
background-color: #222;
|
|
55
|
-
color: white;
|
|
56
|
-
font-family: sans-serif;
|
|
57
|
-
}
|
|
58
|
-
.btn {
|
|
59
|
-
background: gold;
|
|
60
|
-
color: black;
|
|
61
|
-
padding: 10px 20px;
|
|
62
|
-
}
|
|
63
|
-
</style>
|
|
64
|
-
<div class="container">
|
|
65
|
-
<h1>THOTH is Unstoppable!</h1>
|
|
66
|
-
<p>Now with full CSS and JavaScript support.</p>
|
|
67
|
-
<button id="myBtn" class="btn">Click For Magic</button>
|
|
68
|
-
</div>
|
|
69
|
-
<script>
|
|
70
|
-
document.getElementById('myBtn').addEventListener('click', function() {
|
|
71
|
-
alert('THOTH understands JavaScript perfectly!');
|
|
72
|
-
});
|
|
73
|
-
</script>
|
|
74
|
-
<script src="app.js"></script>
|
|
75
|
-
</body>
|
|
76
|
-
</html>
|
package/test.thoth
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
Title style="color: #d4af37; text-align: center;": Welcome to THOTH V2
|
|
2
|
-
Text: Now supporting EVERY HTML element with attributes!
|
|
3
|
-
|
|
4
|
-
Box style="border: 2px dashed #d4af37; padding: 20px; border-radius: 8px;":
|
|
5
|
-
Sub: 1. Full Form Support
|
|
6
|
-
Form:
|
|
7
|
-
Label: Enter your Name:
|
|
8
|
-
Input type="text" placeholder="John Doe":
|
|
9
|
-
Break:
|
|
10
|
-
Label: Choose an option:
|
|
11
|
-
Select:
|
|
12
|
-
Option value="1": Option A
|
|
13
|
-
Option value="2": Option B
|
|
14
|
-
Break:
|
|
15
|
-
Button type="button": Submit Data
|
|
16
|
-
|
|
17
|
-
Line:
|
|
18
|
-
|
|
19
|
-
Sub: 2. Tables and Data
|
|
20
|
-
Table:
|
|
21
|
-
Row:
|
|
22
|
-
Head: ID
|
|
23
|
-
Head: Name
|
|
24
|
-
Head: Role
|
|
25
|
-
Row:
|
|
26
|
-
Data: 1
|
|
27
|
-
Data: Thoth
|
|
28
|
-
Data: Scribe
|
|
29
|
-
Row:
|
|
30
|
-
Data: 2
|
|
31
|
-
Data: Horus
|
|
32
|
-
Data: Guardian
|
|
33
|
-
|
|
34
|
-
Line:
|
|
35
|
-
|
|
36
|
-
Sub: 3. Lists
|
|
37
|
-
OrderedList:
|
|
38
|
-
Item: Clean Syntax
|
|
39
|
-
Item: Python-like Indentation
|
|
40
|
-
Item: Ultimate Power
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
IncludeCss: style.css
|
|
44
|
-
|
|
45
|
-
Style:
|
|
46
|
-
body {
|
|
47
|
-
background-color: #222;
|
|
48
|
-
color: white;
|
|
49
|
-
font-family: sans-serif;
|
|
50
|
-
}
|
|
51
|
-
.btn {
|
|
52
|
-
background: gold;
|
|
53
|
-
color: black;
|
|
54
|
-
padding: 10px 20px;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
Box class="container":
|
|
58
|
-
Title: THOTH is Unstoppable!
|
|
59
|
-
Text: Now with full CSS and JavaScript support.
|
|
60
|
-
Button id="myBtn" class="btn": Click For Magic
|
|
61
|
-
|
|
62
|
-
Script:
|
|
63
|
-
document.getElementById('myBtn').addEventListener('click', function() {
|
|
64
|
-
alert('THOTH understands JavaScript perfectly!');
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
IncludeJs: app.js
|