ether-code 0.9.9 → 0.10.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/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.9.9'
9
+ const VERSION = '0.10.0'
10
10
 
11
11
  const COLORS = {
12
12
  reset: '\x1b[0m',
@@ -660,25 +660,28 @@ class HTMLGenerator {
660
660
  this.indent++
661
661
 
662
662
  if (isRawContent) {
663
- let rawContent = ''
664
663
  for (const child of children) {
665
- if (typeof child === 'string') {
666
- rawContent += child
664
+ if (child.type === 'EtherCSS') {
665
+ this.generateEtherCSS(child)
666
+ } else if (child.type === 'EtherJS') {
667
+ this.generateEtherJS(child)
668
+ } else if (typeof child === 'string') {
669
+ const generatedCode = this.compileEmbeddedCode(child.trim(), tag.toLowerCase())
670
+ const lines = generatedCode.split('\n')
671
+ for (const line of lines) {
672
+ this.writeLine(line)
673
+ }
667
674
  } else if (child.type === 'Text' || child.type === 'text') {
668
675
  const content = child.content || child.text || child.value || ''
669
676
  if (content.trim()) {
670
- rawContent += content
677
+ const generatedCode = this.compileEmbeddedCode(content.trim(), tag.toLowerCase())
678
+ const lines = generatedCode.split('\n')
679
+ for (const line of lines) {
680
+ this.writeLine(line)
681
+ }
671
682
  }
672
683
  }
673
684
  }
674
-
675
- if (rawContent.trim()) {
676
- const generatedCode = this.compileEmbeddedCode(rawContent.trim(), tag.toLowerCase())
677
- const lines = generatedCode.split('\n')
678
- for (const line of lines) {
679
- this.writeLine(line)
680
- }
681
- }
682
685
  } else {
683
686
  for (const child of children) {
684
687
  if (typeof child === 'string') {
@@ -1080,14 +1083,14 @@ class HTMLGenerator {
1080
1083
  if (!node.source) return
1081
1084
 
1082
1085
  try {
1083
- const { EtherParserCSS } = require('./ether-parser-css')
1086
+ const { EtherParserCSS } = require('../parsers/ether-parser-css')
1084
1087
  const { CSSGenerator } = require('./css-generator')
1085
1088
 
1086
1089
  const cssParser = new EtherParserCSS()
1087
1090
  const cssAst = cssParser.parse(node.source)
1088
1091
 
1089
1092
  const cssGenerator = new CSSGenerator()
1090
- cssGenerator.loadI18n('./i18n-css.json')
1093
+ cssGenerator.loadI18n('../i18n/i18n-css.json')
1091
1094
  const cssOutput = cssGenerator.generate(cssAst)
1092
1095
 
1093
1096
  if (cssOutput) {
@@ -1106,14 +1109,14 @@ class HTMLGenerator {
1106
1109
  if (!node.source) return
1107
1110
 
1108
1111
  try {
1109
- const { EtherParserJS } = require('./ether-parser-js')
1112
+ const { EtherParserJS } = require('../parsers/ether-parser-js')
1110
1113
  const { JSGenerator } = require('./js-generator')
1111
1114
 
1112
1115
  const jsParser = new EtherParserJS()
1113
1116
  const jsAst = jsParser.parse(node.source)
1114
1117
 
1115
1118
  const jsGenerator = new JSGenerator()
1116
- jsGenerator.loadI18n('./i18n-js.json')
1119
+ jsGenerator.loadI18n('../i18n/i18n-js.json')
1117
1120
  const jsOutput = jsGenerator.generate(jsAst)
1118
1121
 
1119
1122
  if (jsOutput) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ether-code",
3
- "version": "0.9.9",
3
+ "version": "0.10.0",
4
4
  "description": "Ether - Le langage intentionnel",
5
5
  "main": "cli/compiler.js",
6
6
  "bin": {
@@ -1,5 +1,5 @@
1
1
  const fs = require('fs')
2
- const { EtherLexer, Token, TokenType } = require('../lexer/ether-lexer')
2
+ const { EtherLexer, Token, TokenType } = require('./ether-lexer')
3
3
 
4
4
  class EtherParserBase {
5
5
  constructor(options = {}) {