ether-code 0.3.0 → 0.3.1
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/cli/ether.js +3 -3
- package/generators/html-generator.js +14 -5
- package/package.json +1 -1
package/cli/ether.js
CHANGED
|
@@ -6,7 +6,7 @@ const http = require('http')
|
|
|
6
6
|
const { EtherCompiler } = require('./compiler')
|
|
7
7
|
const { Watcher } = require('./watcher')
|
|
8
8
|
|
|
9
|
-
const VERSION = '0.3.
|
|
9
|
+
const VERSION = '0.3.1'
|
|
10
10
|
|
|
11
11
|
const COLORS = {
|
|
12
12
|
reset: '\x1b[0m',
|
|
@@ -292,8 +292,8 @@ document
|
|
|
292
292
|
meta charset: "UTF-8"
|
|
293
293
|
meta name: "viewport", content: "width=device-width, initial-scale=1.0"
|
|
294
294
|
titre "Ether - Le langage intentionnel"
|
|
295
|
-
|
|
296
|
-
|
|
295
|
+
liaison rel: "icon", type: "image/svg+xml", href: "/favicon.svg"
|
|
296
|
+
liaison rel: "stylesheet", href: "styles.css"
|
|
297
297
|
|
|
298
298
|
corps
|
|
299
299
|
entete classe: "hero"
|
|
@@ -99,7 +99,8 @@ class HTMLGenerator {
|
|
|
99
99
|
'corps': 'body',
|
|
100
100
|
'titre': 'title',
|
|
101
101
|
'meta': 'meta',
|
|
102
|
-
'lien': '
|
|
102
|
+
'lien': 'a',
|
|
103
|
+
'liaison': 'link',
|
|
103
104
|
'style': 'style',
|
|
104
105
|
'script': 'script',
|
|
105
106
|
'entete': 'header',
|
|
@@ -125,7 +126,6 @@ class HTMLGenerator {
|
|
|
125
126
|
'div': 'div',
|
|
126
127
|
'span': 'span',
|
|
127
128
|
'portee': 'span',
|
|
128
|
-
'lien': 'a',
|
|
129
129
|
'image': 'img',
|
|
130
130
|
'figure': 'figure',
|
|
131
131
|
'legende': 'figcaption',
|
|
@@ -416,8 +416,17 @@ class HTMLGenerator {
|
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
generateElement(node) {
|
|
419
|
-
|
|
420
|
-
const
|
|
419
|
+
let tag = this.translateTag(node.tag || node.tagName || node.name)
|
|
420
|
+
const attrs = node.attributes || node.attrs || {}
|
|
421
|
+
|
|
422
|
+
if (tag === 'a' && attrs.rel) {
|
|
423
|
+
const linkRels = ['stylesheet', 'icon', 'preconnect', 'prefetch', 'preload', 'dns-prefetch', 'canonical', 'alternate', 'manifest', 'apple-touch-icon']
|
|
424
|
+
if (linkRels.some(r => attrs.rel.includes(r))) {
|
|
425
|
+
tag = 'link'
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
const attributes = this.generateAttributes(attrs)
|
|
421
430
|
const isVoid = this.voidElements.includes(tag.toLowerCase())
|
|
422
431
|
|
|
423
432
|
if (isVoid) {
|
|
@@ -427,7 +436,7 @@ class HTMLGenerator {
|
|
|
427
436
|
|
|
428
437
|
const children = node.children || node.content || []
|
|
429
438
|
const hasChildren = Array.isArray(children) && children.length > 0
|
|
430
|
-
const textContent = typeof children === 'string' ? children :
|
|
439
|
+
const textContent = typeof children === 'string' ? children :
|
|
431
440
|
(node.text || node.textContent || null)
|
|
432
441
|
|
|
433
442
|
if (textContent && !hasChildren) {
|