ether-code 0.6.4 → 0.6.5

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.6.4'
9
+ const VERSION = '0.6.5'
10
10
 
11
11
  const COLORS = {
12
12
  reset: '\x1b[0m',
package/ether-parser.js CHANGED
@@ -1178,6 +1178,7 @@ class EtherParser {
1178
1178
  parseHTMLElement() {
1179
1179
  const tagToken = this.current()
1180
1180
  let tagName = this.normalizeAccents(tagToken.value)
1181
+ const originalTagName = tagName
1181
1182
  this.advance()
1182
1183
 
1183
1184
  const includeKeywords = ['inclure', 'requiert', 'include', 'require', 'importer']
@@ -1813,6 +1814,13 @@ class EtherParser {
1813
1814
  }
1814
1815
  }
1815
1816
 
1817
+ if (originalTagName === 'document') {
1818
+ return {
1819
+ type: 'Doctype',
1820
+ children: children
1821
+ }
1822
+ }
1823
+
1816
1824
  return {
1817
1825
  type: 'Element',
1818
1826
  tag: tag,
@@ -546,8 +546,10 @@ class HTMLGenerator {
546
546
 
547
547
  if (children.length > 0) {
548
548
  const firstChild = children[0]
549
+ const firstType = (firstChild.type || '').toLowerCase()
549
550
  const firstTag = (firstChild.tag || firstChild.tagName || '').toLowerCase()
550
- if (firstTag === 'html' || firstTag === 'document') {
551
+
552
+ if (firstType !== 'doctype' && (firstTag === 'html' || firstTag === 'document')) {
551
553
  this.output += '<!DOCTYPE html>\n'
552
554
  }
553
555
  }
@@ -907,6 +909,11 @@ class HTMLGenerator {
907
909
 
908
910
  generateDoctype(node) {
909
911
  this.output += '<!DOCTYPE html>\n'
912
+ if (node.children && node.children.length > 0) {
913
+ for (const child of node.children) {
914
+ this.generateNode(child)
915
+ }
916
+ }
910
917
  }
911
918
 
912
919
  generateInclude(node) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ether-code",
3
- "version": "0.6.4",
3
+ "version": "0.6.5",
4
4
  "description": "Ether - Le langage intentionnel",
5
5
  "main": "cli/compiler.js",
6
6
  "bin": {