assoba-template-api

Assoba template engine API

License

License

GroupId

GroupId

fr.assoba.open
ArtifactId

ArtifactId

assoba-template-api
Last Version

Last Version

1.0
Release Date

Release Date

Type

Type

jar
Description

Description

assoba-template-api
Assoba template engine API

Download assoba-template-api

How to add to project

<!-- https://jarcasting.com/artifacts/fr.assoba.open/assoba-template-api/ -->
<dependency>
    <groupId>fr.assoba.open</groupId>
    <artifactId>assoba-template-api</artifactId>
    <version>1.0</version>
</dependency>
// https://jarcasting.com/artifacts/fr.assoba.open/assoba-template-api/
implementation 'fr.assoba.open:assoba-template-api:1.0'
// https://jarcasting.com/artifacts/fr.assoba.open/assoba-template-api/
implementation ("fr.assoba.open:assoba-template-api:1.0")
'fr.assoba.open:assoba-template-api:jar:1.0'
<dependency org="fr.assoba.open" name="assoba-template-api" rev="1.0">
  <artifact name="assoba-template-api" type="jar" />
</dependency>
@Grapes(
@Grab(group='fr.assoba.open', module='assoba-template-api', version='1.0')
)
libraryDependencies += "fr.assoba.open" % "assoba-template-api" % "1.0"
[fr.assoba.open/assoba-template-api "1.0"]

Dependencies

compile (4)

Group / Artifact Type Version
org.scala-lang : scala-compiler jar 2.10.1
org.scalatest : scalatest_2.10 jar 1.9.1
commons-lang : commons-lang jar 2.6
com.github.scala-incubator.io : scala-io-file_2.10 jar 0.4.2

Project Modules

There are no modules declared in this project.

assoba-template

Introduction

Just another fork of the play2 template library, aka twirl

Why the play2 template system instead of Scalate

One word: IDE's, both eclipse and IDEA support the play2 template syntax and provide static typing helpers.

While HAML derived languages are great for HTML templating, they are not designed for generic text templating, wich means that the only Scalate competitor is SSP. The Play2 syntax is both more simple (to write, not to parse :D) and more typesafe than the SSP one.

Why fork ?

Both Play2 and Twirl are designed to be used from SBT, bringing the sbt dependency on scala 2.9.x, for scala 2.10 developpements, this means quite a lot of cruft in the maven plugin.

This fork also includes some design choices on template name detection and template "format" detection that are more germane to generic templating and not only HTML templating.

How to use it ?

Include the following tiny runtime dependency in the project that will use templates.

<dependency>
        <groupId>fr.assoba.open</groupId>
        <artifactId>assoba-template-api</artifactId>
        <version>1.0</version>
</dependency>

Add the following plugin to the build>plugins section in your pom

<plugin>
    <groupId>fr.assoba.open</groupId>
    <artifactId>template-maven-plugin</artifactId>
    <version>1.0</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal>
            </goals>
        </execution>
    </executions>
</plugin>

Put your templates beside your scala code in src/main/scala,

templates should be named [CLASSNAME].stl for generic templates and [CLASSNAME].html.stl for html templates (with play2 escaping rules)

Template syntax documented in the play2 documentation

Both m2eclipse and IDEA should detect the generated-sources automatically

Credits

All credits are to go to the Play developers who devised the template language and provided its implementation!

Versions

Version
1.0