ether-code 0.3.0 → 0.3.2

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 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.0'
9
+ const VERSION = '0.3.2'
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
- lien rel: "icon", type: "image/svg+xml", href: "/favicon.svg"
296
- lien rel: "stylesheet", href: "styles.css"
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"
package/ether-parser.js CHANGED
@@ -278,6 +278,8 @@ class EtherParser {
278
278
  const decl = this.parseCSSDeclaration()
279
279
  if (decl) {
280
280
  declarations.push(decl)
281
+ } else {
282
+ this.advance()
281
283
  }
282
284
  }
283
285
 
@@ -474,6 +476,8 @@ class EtherParser {
474
476
  const decl = this.parseCSSDeclaration()
475
477
  if (decl) {
476
478
  declarations.push(decl)
479
+ } else {
480
+ this.advance()
477
481
  }
478
482
  }
479
483
 
@@ -99,7 +99,8 @@ class HTMLGenerator {
99
99
  'corps': 'body',
100
100
  'titre': 'title',
101
101
  'meta': 'meta',
102
- 'lien': 'link',
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
- const tag = this.translateTag(node.tag || node.tagName || node.name)
420
- const attributes = this.generateAttributes(node.attributes || node.attrs || {})
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ether-code",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Ether - Le langage intentionnel",
5
5
  "main": "cli/compiler.js",
6
6
  "bin": {