-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Qute standalone - format functions for java.time.ZonedDateTime #19555
Comments
/cc @mkouba |
reproducer: update.java: ///usr/bin/env jbang "$0" "$@" ; exit $?
//DEPS io.quarkus.qute:qute-core:2.2.0.CR1
//DEPS https://github.com/w3stling/rssreader/tree/v2.5.0
//JAVA 16+
import com.apptastic.rssreader.Item;
import com.apptastic.rssreader.RssReader;
import io.quarkus.qute.Engine;
import io.quarkus.qute.EvalContext;
import io.quarkus.qute.ReflectionValueResolver;
import io.quarkus.qute.ValueResolver;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.stream.Collectors;
import java.util.stream.Stream;
public class update {
public static void main(String... args) throws IOException {
String bio = """
blah
""";
RssReader reader = new RssReader();
Stream<Item> rssFeed = reader.read("https://xam.dk/blog/feed.atom");
List<Item> posts = rssFeed.collect(Collectors.toList());
var x = posts.get(0).getPubDateZonedDateTime();
Engine engine = Engine.builder()
.removeStandaloneLines(true)
.addValueResolver(new ReflectionValueResolver())
.addDefaults()
.build();
Files.writeString(Path.of("readme.adoc"), engine.parse(Files.readString(Path.of("template.adoc.qute")))
.data("bio", bio)
.data("posts", posts)
.render());
}
} and
|
hmm - even time: namespace are not available. Is this a case of quarkus configures qute to have these but they are not available in the standalone setup ? |
AFAIK you need to add a ValueResolver to your |
yes thats fine but then imo the docs should not say its there by default and preferably say what resolver to add to get it....in this case though its hidden inside the quarkus extension not in qute itself. |
Well, this feature is implemented via template extension methods and it's listed under the Quarkus Integration section. There's no built-in value resolver that could be used for a standalone |
What are the reasons why all the basic defaults are only in quarkus ? Would at least be helpful docs would point out what is in qute and what is uniquely quarkus. |
Well, Qute is primarily intended to be used as a Quarkus extension. It is possible to use it standalone but then many features (such as type-safe templates) are not available because we're not able to perform the pre-processing during the build phase. Some of those features could be ported to a runtime-only environment but this approach has its drawbacks. First of all, we would have to maintain two implementations of the same feature. And that's something we'd like to avoid.
Quarkus-specific features are described under the 3. Quarkus Integration section. |
FTR the limitations of Qute standalone are described here: https://quarkus.io/guides/qute-reference#standalone |
Qute standalone is not our primary target. Therefore, I'm going to list the default value resolvers in the Qute Used as a Standalone Library section and close this issue. |
- related to quarkusio#19555 Co-authored-by: George Gastaldi <[email protected]>
Description
docs at https://quarkus.io/guides/qute-reference#built-in-template-extension says
format
exits for ZonedDateTime but when calling it i get:note: i'm using qute standalone if that matters
Implementation ideas
No response
The text was updated successfully, but these errors were encountered: