1
0
mirror of https://codeberg.org/setop/elm-scripting synced 2025-11-08 21:49:57 +00:00

handle innerHTML

This commit is contained in:
2025-10-05 01:35:45 +02:00
parent 9566f305b5
commit 6050fb02a3
5 changed files with 17 additions and 6 deletions

View File

@@ -1 +1,2 @@
elm 0.19.1
python 3.13.1-v2

View File

@@ -18,10 +18,11 @@
# Minor
- [ ] support for Elm debug mode (qjs does not implement `console.warn`, only `console.log`)
- [ ] support for Elm debug (`-d`) mode (qjs does not implement `console.warn`, only `console.log`)
- [ ] in debug mode, keep the output
- [ ] allow to specify or guess the main module name
- [ ] allow to create standalone (`s`) HTML document instead of fragment
- [x] allow to specify or guess the main module name
- [x] if `innerHTML` attribute is set, output its value instead of the node tree
- [ ] allow to create standalone (`-s`) HTML document instead of fragment
- [ ] silence elm compiler message when successful
- [ ] skip compilation steps if source has not been modified ; run directly ; this mean keeping the output
- [ ] add proper copyright and license

View File

@@ -2,8 +2,7 @@
w1="$(mktemp out_$$_1_XXXX.js)"
#elm make --optimize --output=${w1} src/Main.elm 1>&2
elm make --output=${w1} src/Main.elm 1>&2
elm make --output=${w1} $1 1>&2
sed -i -e 's!console.warn(!console.log(!g' ${w1}
w2="$(mktemp out_$$_XXXX.js)"

10
dom.js
View File

@@ -21,6 +21,10 @@ function Node(parent, tag) {
print(this.text);
return
}
if (this.innerHTML) {
print(this.innerHTML);
return
}
std.printf("<%s", this.tagName)
// Set.difference(other) is not avalable in qjs
for (a of Object.keys(this)) {
@@ -52,3 +56,9 @@ document.getElementById = (_id) => { return target}
document.createElement = (tag) => new Node(null, tag);
document.createTextNode = (text) => { t = new Node(null, "#text" ); t.text = text; return t }
// workaround for elm-explorations/markdown Markdown.toHtml
global = {};

View File

@@ -1,3 +1,3 @@
#!/bin/sh -eu
countuniq0 build.sh dom.js launch.js
countuniq0 build.sh dom.js postelm.js preelm.js