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

JteModels extension with a 'Plain' (non-HTML engine) #370

Open
checketts opened this issue Aug 6, 2024 · 7 comments
Open

JteModels extension with a 'Plain' (non-HTML engine) #370

checketts opened this issue Aug 6, 2024 · 7 comments
Labels
gradle help wanted Extra attention is needed

Comments

@checketts
Copy link
Contributor

checketts commented Aug 6, 2024

In following the JteModels documentation I seem to be able to only create Html based templates.

However, I need to create a few text (plain) templates.

Does that support exist? Any hint on how that might be configured?

I'll be happy to provide a PR for the docs once I figure out what is missing...

@edward3h
Copy link
Contributor

edward3h commented Aug 6, 2024

Hi @checketts,
I'm the author of jte-models. I'm kinda busy but I will try to get back to you at the weekend.

@checketts
Copy link
Contributor Author

Thanks for the jte-models!

Here is my imagined way of making it work:

    //Generate HTML based templates
    jteExtension("gg.jte.models.generator.ModelExtension") {
        property("language", "Kotlin")
        property("excludePattern", ".*_text.*")
    }

    //Generate Text based templates
    jteExtension("gg.jte.models.generator.ModelExtension") {
        property("language", "Kotlin")
        property("package", "gg.jte.generated.precompiled.text") // Will place the `Templates` classes in this package
        property("contentType", "plain")
        property("includePattern", ".*_text.*")
    }

Note the new package and contentType options.

@edward3h
Copy link
Contributor

jte-models can generate models for plain text templates. It uses the contentType specified on the jte { } block in Gradle.

This does make it difficult to use both HTML and plain templates at the same time. I think you would have to put them in separate submodules.

@edward3h
Copy link
Contributor

Sorry for the delay in responding, by the way.

@edward3h
Copy link
Contributor

It would not be too hard to make your imagined configuration work, but it would require some code changes.

@checketts
Copy link
Contributor Author

Thanks for the response. My usecase is generating emails, since email has an HTML envelope and a plaintext. So separate modules wouldn't necessarily work for me.

Are you aware of a way to pass separate jteExtension config to a separate Gradle task? Perhaps I could investigate that route.

@edward3h
Copy link
Contributor

The JTE Gradle plugin currently makes some assumptions that will prevent you configuring a separate task with different settings. It would be good to fix, but I don't have time available to work on that at the moment.

@casid casid added help wanted Extra attention is needed gradle labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gradle help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants