Skip to content
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

Pug4j templates #27

Open
noraj opened this issue Nov 6, 2023 · 5 comments
Open

Pug4j templates #27

noraj opened this issue Nov 6, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@noraj
Copy link

noraj commented Nov 6, 2023

Describe the feature

Support pug4j templates natively.

Additional context
I'm new to Java and I failed to register pug4j as a new engine.

        // Register Pug4J template engine
        JavalinRenderer.register((filePath, model, ctx) -> {
            PugTemplate template = Pug4J.getTemplate(filePath);
            return Pug4J.render(template, model);
        }, ".pug");

        app.get("/pug4j", ctx -> {
            ctx.render("views/test.pug", model("firstName", "John", "lastName", "Doe"));
        });
@tipsy tipsy added the enhancement New feature or request label Nov 6, 2023
@tipsy
Copy link
Member

tipsy commented Nov 6, 2023

@noraj I think it's unlikely that someone else will pick this up. Maybe I can help you finish the integration, where did you get stuck?

@noraj
Copy link
Author

noraj commented Nov 6, 2023

This example returns:

no suitable method found for render(de.neuland.pug4j.template.PugTemplate,java.util.Map<java.lang.String,capture#1 of ? extends java.lang.Object>)
[ERROR]     method de.neuland.pug4j.Pug4J.render(java.lang.String,java.util.Map<java.lang.String,java.lang.Object>) is not applicable
[ERROR]       (argument mismatch; de.neuland.pug4j.template.PugTemplate cannot be converted to java.lang.String)
[ERROR]     method de.neuland.pug4j.Pug4J.render(de.neuland.pug4j.template.PugTemplate,java.util.Map<java.lang.String,java.lang.Object>) is not applicable
[ERROR]       (argument mismatch; java.util.Map<java.lang.String,capture#1 of ? extends java.lang.Object> cannot be converted to java.util.Map<java.lang.String,java.lang.Object>)
[ERROR]     method de.neuland.pug4j.Pug4J.render(java.net.URL,java.util.Map<java.lang.String,java.lang.Object>) is not applicable
[ERROR]       (argument mismatch; de.neuland.pug4j.template.PugTemplate cannot be converted to java.net.URL)

@tipsy
Copy link
Member

tipsy commented Nov 6, 2023

That's a lot of error messages. Could you publish an example repo?

@noraj
Copy link
Author

noraj commented Nov 7, 2023

@tipsy
Copy link
Member

tipsy commented Nov 8, 2023

Thanks, I'll have a look next week!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants