SVGHMI: fix syntax error in sprintf.js and force makefile to regen xslt files when sprintf.js changes
authorEdouard Tisserant
Fri, 06 May 2022 11:02:03 +0200
changeset 3468 3725487d5468
parent 3467 d8b9ed779728
child 3469 97622e9560b5
SVGHMI: fix syntax error in sprintf.js and force makefile to regen xslt files when sprintf.js changes
svghmi/Makefile
svghmi/sprintf.js
--- a/svghmi/Makefile	Fri May 06 11:01:07 2022 +0200
+++ b/svghmi/Makefile	Fri May 06 11:02:03 2022 +0200
@@ -15,9 +15,11 @@
 ysl2includes := $(filter-out $(ysl2files), $(wildcard *.ysl2))
 xsltfiles := $(patsubst %.ysl2, %.xslt, $(ysl2files))
 
+jsfiles := svghmi.js sprintf.js
+
 all:$(xsltfiles)
 
-%.xslt: %.ysl2 $(ysl2includes) svghmi.js ../yslt_noindent.yml2
+%.xslt: %.ysl2 $(ysl2includes) $(jsfiles) ../yslt_noindent.yml2
 	$(yml2path)/yml2c -I $(yml2path):../ $< -o $@.tmp
 	xmlstarlet fo $@.tmp > $@
 	rm $@.tmp
--- a/svghmi/sprintf.js	Fri May 06 11:01:07 2022 +0200
+++ b/svghmi/sprintf.js	Fri May 06 11:02:03 2022 +0200
@@ -95,12 +95,12 @@
                             see meaning of DateTimeFormat's options "datestyle" and "timestyle" in MDN 
                         */
 
-                        let [datestyle, timestyle] = [ph.width, ph.precision].map(val => {
+                        let [datestyle, timestyle] = [ph.width, ph.precision].map(val => ({
                             1: "short",
                             2: "medium",
                             3: "long",
                             4: "full"
-                        }[val]);
+                        }[val]));
 
                         if(timestyle === undefined && datestyle === undefined){
                             timestyle = "short";