Formatting options

9 views
Skip to first unread message

Peter Vlugter

unread,
Feb 20, 2012, 8:17:52 PM2/20/12
to git...@googlegroups.com
Just a heads up that a new feature is coming to giter8: formatting options for template attributes. This uses a StringTemplate AttributeRenderer so that formatting options can be added with:

$field;format="option"$

The idea is to have more flexibility and also some guarantees with how attributes are rendered, allowing the same attribute to be used in different ways. As an example, it's now possible to have a template file named $name__Camel$Build.scala with:

object $name;format="Camel"$Build extends Build {
lazy val $name;format="camel"$ = Project(
id = "$name;format="norm"$",
settings = Project.defaultSettings ++ Seq(
name := "$name$"

and given name = "My Project" have it render a file named MyProjectBuild.scala with:

object MyProjectBuild extends Build {
lazy val myProject = Project(
id = "my-project",
settings = Project.defaultSettings ++ Seq(
name := "My Project"

The readme docs for this can currently be found here: https://github.com/pvlugter/giter8

And here's a test template that makes use of these options: https://github.com/pvlugter/formatted-test.g8

Peter

Reply all
Reply to author
Forward
0 new messages