Re: Omitting template markup characters

Kjeld <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
I used some whitespaces / indentation in my template file to make it more
readable like so:

<#list my collection as item>
	${"11"}
		${item.id?string?left_pad(12, "0")}
		${item.labelCode?right_pad(10)}
	${"\r\n"}
</#list>

Which produces something like:

	11
		000000000123
		aCode

...because of the whitespaces and line breaks in my template file. Bubut
what I actually want it to produce is:

11000000000123aCode     

I solved this by preprocessing the template file to a temp file, omitting
whitespaces etc and using that temp file. Considering time and performance
for now this is adequate for me. 
Still, I briefly looked into the custom TemplateLoader option and I did not
find an appropriate example. I created a MyTemplateLoader implements
TemplateLoader (also tried extending FileTemplateLoader) and fed it to
configuration. But when I use configuration.setDirectoryForTemplateLoading
afterwards, configuration.getTemplateLoader returns its default
FileTemplateLoader again...:S Why is that?
More importantly, I noticed MyTemplateLoader.getReader is never accessed. 
Any ideas?

Cheers 
Kjeld






-- 
View this message in context: http://freemarker.624813.n4.nabble.com/Omitting-template-markup-characters-tp2065383p2068819.html
Sent from the freemarker-user mailing list archive at Nabble.com.

------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.