Template code Chunk output
{#example_1}
{!-- Load templates from specific folder: See Java tab --}
{#}
// Chunk favors convention over configuration, and your deployment
// will be simpler if you can figure out how to add your themes
// folder to your application's classpath.

// But, if you really want to load your theme template files from
// a different folder, outside the classpath, you can certainly do so:

String themesPath = "/path/to/my/templates";
String layerNames = "";   // no layers

Theme theme = new Theme(themesPath, layerNames);

// Load up the main template in /path/to/my/templates/my_template.chtml
Chunk html = theme.makeChunk("my_template");

return html.toString();
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.


Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Template code Chunk output
{#example_2}
{!-- Use .html as template file extension: See Java tab --}
{#}
// Lets say you want to use .html as the default extension, so you can
// easily edit your templates in an HTML editor.
Theme theme = new Theme();
theme.setDefaultExtension("html");

// Load up the main template in [classpath]/themes/my_template.html
Chunk html = theme.makeChunk("my_template");

return html.toString();
Lorem ipsum dolor sit amet, consectetur adipisicing elit,
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum.


Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Template code Chunk output
{#example_3}
{!-- Extreme non-standard config: See Java tab --}
{#}
// Let's say you want to use .txt as the default extension, with
// ISO-8859-1 encoding (the default is UTF-8), from the
// /path/to/my/templates folder.
//
// Plus, you want to translate all marked-up _[Strings] into German
// using the locale files in /path/to/my/locales/de_DE/translate.csv
// (also ISO-8859-1 encoded).

String themesPath = "/path/to/my/templates";
String layerNames = "";
Theme textTheme = new Theme(themesPath, layerNames);
textTheme.setDefaultExtension("txt");
textTheme.setLocale("de_DE");
textTheme.setEncoding("ISO-8859-1");

// For now, you must configure localization via system properties.
// This can be done in code or with -Dprop=value from the JVM
// command line.
System.setProperty("chunk.localedb.charset", "ISO-8859-1");
System.setProperty("chunk.localedb.path",    "/path/to/my/locales");

// Load up the main template in /path/to/my/templates/my_template.txt
Chunk txt = textTheme.makeChunk("my_template");

return txt.toString();
Kaputt auf auf, nicht mitten deutsch haben wearin. Noodle haus blitz
kaboodle biergarten sparkin, sparkin corkin. Flippin makin poken
thinken poken du, poken unter. Uber sightseerin, und rubberneckin
footzerstompen kaputt octoberfest underbite oof weiner. Wearin achtung
sightseerin haben uber, floppern mitten er blitz die. Gewerkin blitz
heinee meister ya sightseerin ist mitz heinee makin oof sparkin heinee
frau. Das uber du haben nicht meister keepin spitzen. Dorkin gewerkin
nicht, oof morgen flippin nicht, dummkopf mitz gewerkin in relaxern,
sparkin verboten.

Kaputt auf auf, nicht mitten deutsch haben wearin. Noodle haus blitz kaboodle biergarten sparkin, sparkin corkin. Flippin makin poken thinken poken du, poken unter. Uber sightseerin, und rubberneckin footzerstompen kaputt octoberfest underbite oof weiner. Wearin achtung sightseerin haben uber, floppern mitten er blitz die. Gewerkin blitz heinee meister ya sightseerin ist mitz heinee makin oof sparkin heinee frau. Das uber du haben nicht meister keepin spitzen. Dorkin gewerkin nicht, oof morgen flippin nicht, dummkopf mitz gewerkin in relaxern, sparkin verboten.