tomj74 / chunk-templates

Chunk Templates, a template engine for Java
http://www.x5software.com/chunk/
MIT License
77 stars 10 forks source link

Dealing with file extensions other than chtml #6

Closed slisznia closed 9 years ago

slisznia commented 9 years ago

We have template files that are TXT or Markdown, .txt .md respectively. Unfortunately they are not located by chunk, which insists on chtml. Being a generic, non-html specific engine, this appears to be an unnecessary limitation.

What is the suggested way of handling non-html text files?

tomj74 commented 9 years ago

I believe either of these will work:

textChunk = theme.makeChunk("filename.txt"); textChunk = theme.makeChunk("filename", "txt"); mdChunk = theme.makeChunk("filename.md"); mdChunk = theme.makeChunk("filename", "md");

slisznia commented 9 years ago

Thanks!

tomj74 commented 9 years ago

If you have snippets of content defined inside those files a la {#snippet}an extra chunk of template{#} then you can even refer to those directly like so:

Chunk mdChunklet = theme.makeChunk("filename.md#snippet");

slisznia commented 9 years ago

Perhaps this paragraph can be relaxed and/or updated with the info you just provided:

http://www.x5software.com/chunk/wiki/#Leave_out_the_extension.21

On 07/06/2015 12:16 PM, Tom McClure wrote:

If you have snippets of content defined inside those files a la {#snippet}an extra chunk of template{#} then you can even refer to those directly like so:

Chunk mdChunklet = theme.makeChunk("filename.md#snippet");

— Reply to this email directly or view it on GitHub https://github.com/tomj74/chunk-templates/issues/6#issuecomment-118928597.

Slawomir Lisznianski Developer at PushCoin

tomj74 commented 9 years ago

Ah, thanks. This was a fairly recent change, and I missed updating that piece of the docs. Fixed!