diff --git a/src/main/java/de/neuland/pug4j/parser/node/AttrsNode.java b/src/main/java/de/neuland/pug4j/parser/node/AttrsNode.java index 971db76..b1890d3 100644 --- a/src/main/java/de/neuland/pug4j/parser/node/AttrsNode.java +++ b/src/main/java/de/neuland/pug4j/parser/node/AttrsNode.java @@ -1,5 +1,6 @@ package de.neuland.pug4j.parser.node; +import java.time.Instant; import java.util.*; import com.google.gson.Gson; @@ -272,9 +273,13 @@ else if (expressionValue != null && expressionValue.getClass().isArray()) { if (template.isTerse()) { value = null; } + } else if (expressionValue instanceof Instant) { + Instant instantValue = (Instant) expressionValue; + value = instantValue.toString(); } else if ( - expressionValue.getClass().isArray() - || expressionValue instanceof Map || expressionValue instanceof List + expressionValue.getClass().isArray() + || expressionValue instanceof Map + || expressionValue instanceof List ) { value = StringEscapeUtils.unescapeJava(gson.toJson(expressionValue)); }else{ diff --git a/src/test/java/de/neuland/pug4j/integration/OriginalPug3Test.java b/src/test/java/de/neuland/pug4j/integration/OriginalPug3Test.java index 8ab3b2b..052b1a6 100644 --- a/src/test/java/de/neuland/pug4j/integration/OriginalPug3Test.java +++ b/src/test/java/de/neuland/pug4j/integration/OriginalPug3Test.java @@ -23,13 +23,10 @@ public class OriginalPug3Test { // try to read files in ../ //unsupported - "styles", // wrong indent, rest ok. "filters.include", //unsupported filters "filters.stylus", //missing filter "filters.less", // missing filter "filters.nested", // missing filter - "attrs-data", // only timeformat different - "attrs", // only timeformat different "filter-in-include", // missing less filter "pipeless-filters", //maybe missing markdown-it or different markdown syntax as in js markdown "code.iteration", // function block not working in buffered code. Maybe report to GraalVM Bugtracker. diff --git a/src/test/resources/pugjs@3.0.2/cases/attrs-data.html b/src/test/resources/pugjs@3.0.2/cases/attrs-data.html index 71116d3..c5a3abf 100644 --- a/src/test/resources/pugjs@3.0.2/cases/attrs-data.html +++ b/src/test/resources/pugjs@3.0.2/cases/attrs-data.html @@ -3,4 +3,4 @@ - + diff --git a/src/test/resources/pugjs@3.0.2/cases/attrs-data.pug b/src/test/resources/pugjs@3.0.2/cases/attrs-data.pug index 9e5b4b6..36ff864 100644 --- a/src/test/resources/pugjs@3.0.2/cases/attrs-data.pug +++ b/src/test/resources/pugjs@3.0.2/cases/attrs-data.pug @@ -4,4 +4,4 @@ foo(data-items=[1,2,3]) foo(data-username='tobi') foo(data-escaped={message: "Let's rock!"}) foo(data-ampersand={message: "a quote: " this & that"}) -foo(data-epoc=new Date(0)) +foo(data-epoc=new Date(1)) diff --git a/src/test/resources/pugjs@3.0.2/cases/attrs.html b/src/test/resources/pugjs@3.0.2/cases/attrs.html index 9dcaee5..f243769 100644 --- a/src/test/resources/pugjs@3.0.2/cases/attrs.html +++ b/src/test/resources/pugjs@3.0.2/cases/attrs.html @@ -10,7 +10,7 @@ - + diff --git a/src/test/resources/pugjs@3.0.2/cases/attrs.pug b/src/test/resources/pugjs@3.0.2/cases/attrs.pug index d4420e3..3098fd1 100644 --- a/src/test/resources/pugjs@3.0.2/cases/attrs.pug +++ b/src/test/resources/pugjs@3.0.2/cases/attrs.pug @@ -20,7 +20,7 @@ select a(foo="class:") input(pattern='\\S+') foo(terse="true") -foo(date=new Date(0)) +foo(date=new Date(1)) foo(abc ,def) diff --git a/src/test/resources/pugjs@3.0.2/cases/styles.html b/src/test/resources/pugjs@3.0.2/cases/styles.html index 251556e..743b276 100644 --- a/src/test/resources/pugjs@3.0.2/cases/styles.html +++ b/src/test/resources/pugjs@3.0.2/cases/styles.html @@ -11,10 +11,10 @@
-
-
+
+
+
-