Re: loading plain files

Daniel Dekany <[email protected]>
Newsgroups gmane.comp.web.freemarker.user
Message-ID <[email protected]>
Monday, November 17, 2008, 5:13:33 PM, Luther Baker wrote:

> On Mon, Nov 17, 2008 at 4:47 AM, Daniel Dekany <[email protected]> wrote:
> 
>> Sunday, November 16, 2008, 8:50:40 PM, Luther Baker wrote:
>>
>> <snip../>
>>
>> All this complication is unnecessary. I mean, only the
>> not-exactly-perfect design of the FreeMarker caching/storage API-s
>> make it necessary... But we have this:
>>
>>
>> http://freemarker.org/docs/api/freemarker/template/Template.html#getPlainTextTemplate(java.lang.String,%20java.lang.String,%20freemarker.template.Configuration)<http://freemarker.org/docs/api/freemarker/template/Template.html#getPlainTextTemplate%28java.lang.String,%20java.lang.String,%20freemarker.template.Configuration%29>
>>
>> so, you *can* safely parse "non-template templates" without escaping
>> tricks and like, only you can't explain to the TemplateCache to use
>> this method for parsing if the the template name doesn't end with ftl.
> 
> Ah ... where were you hiding this! :-)
> 
> Let me quick confirm ... the Reader for the ctor is just a simple reader I
> just created there on the spot. IE: doesn't have to be connected to the
> template in any way - the engine will do that for me. So - even after I read
> this template the first time, I have to set this up for every subsequent
> request for this template.

Well, I don't know what are you talking about. :) But what I said is
that FreeMarker already can parse "plain text" to Template, only you
can NOT use it yet, because you use a TemplateCache (indirectly), and
it will not use the getPlainTextTemplate method. And that we should
fix this, be adding the required public API-s.

> Also, the 'content' parameter for the method you exposed here
> (getPlainTextTemplate) ... what does that represent. I think the Javadoc is
> unclear. The descriptive name tells me 'content' ... yikes - but that is
> what I want you to read from the template file. So - is content just a
> label? IE: what does it mean "the block of text that this template
> represents".

The "content" is the text of the template. Like, in your case, the
content of "jQuery.js" file. (The other String parameer, "name", is
the *fake* file name of the template. That's useful for error messages
and to resolve relative paths.)

> Many thanks for your time,
> 
> -Luther

-- 
Best regards,
 Daniel Dekany


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
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.