Re: Using FMPP Output Tags separately

alebu <[email protected]> Mon, 7 Dec 2009 21:07:47 +0200
Newsgroups gmane.comp.text.fmpp
Message-ID <[email protected]>
Thanks for superior answer!
Maybe I will use FMPP as an example of those output tags implementation.


On Mon, Dec 7, 2009 at 8:04 PM, Daniel Dekany <[email protected]> wrote:
> Monday, December 7, 2009, 5:08:02 PM, alebu wrote:
>
>> Hi all,
>>
>> I need some guidelines about FMPP API. I am interested in collecting
>> data for FMPP engine using my own code. In general, I only interested
>> in those wanderfull tags, that allows to create multiple outputs from
>> single template. The questions are:
>> 1) What objects are responsible for actual generation part of code?
>
> Sorry, I don't understant the question. Could you be more specific?
> Responsible for the generation of... what?
>
>> 2) How to configure them ? I was looking at code and I saw that
>> TemplateEnvironment has some tags definitions, and Engine is using it
>> somehow.
>>
>> 3) How to specify to search templates in classpath (it is important
>> for me).
>
> Unfortunatelly that's not supported by FMPP... altough FreeMarker
> itself can load template from classpath, but there is no public API in
> FMPP to achieve that. Worst, it has a real reason that it hasn't: FMPP
> directly uses java.io.File etc. to process the source directory (which
> not only consist of templates, so I couldn't use FreeMarker's loader
> anyway). Next time I write a preprocessor surely I will use some kind
> of virtual file-system, but when I wrote FMPP, I just didn't need
> that... and now, it would be quite a work to allow loading from non-fs
> sources. Unless, you just want to #import/#include those
> classloader-loaded templates, becaue via "freemarkerLinks" (see on
> http://fmpp.sourceforge.net/settings.html) those templates can be
> outside the source root directory. Currently even "freemarkerLinks"
> only support plain files, but that wouldn't be a big deal to improve.
>
>> Also, if templates uses some macros and additional includes,
>> then it must be specified too. It is probably more Freemarker
>> question, but still...
>
> See above... FreeMarker has its own template loader mechanism... that
> can do things that FMPP's own "loader" can't (and the other way
> around).
>
>> In few words, i want to write a code that:
>> 1) Takes some data (as freemarker content)
>
> What do you mean? FreeMarker has templates, and that's not "data", but
> a "program".
>
>> 2) Instanciate FMPP Engine, configures it to use those tags and search
>> templates and other Freemarker specific resources in classpath.
>>
>> 3) Processes data. Here I need to correctly handle output.
>>
>> Or maybe it is worth to somehow move those fmpp specific tags into
>> freemarker environment? In this case, how can it be done?
>
> In general, if the approach of FMPP (that can be grasped from the
> Qucik Start chapter) doesn't fit your task then don't use it. It's a
> tool for a quite specific class of tasks... If yours differs (that I
> don't know) FMPP will more in your way than it hellps, and you are
> better of using pure FreeMarker. The FMPP tags are not necesarly easy
> to extract as is, because they depend on FMPP... but then, you only
> have to implement the tags that your application needs. You need
> something similar that a certain FMPP tag, you can still peek into the
> FMPP source code... Those output slitter tags you meantion are quite
> trivial to implement. You will immediatelly see if you look at
> FreeMarker.
>
>> General overview of solution will be fine for me, just point me please
>> on the right directions (classes, execution chain, etc).
>>
>> Thanks in advance!
>
> --
> Best regards,
> =A0Daniel Dekany
>
>
> -------------------------------------------------------------------------=
-----
> Join us December 9, 2009 for the Red Hat Virtual Experience,
> a free event focused on virtualization and cloud computing.
> Attend in-depth sessions from your desk. Your couch. Anywhere.
> http://p.sf.net/sfu/redhat-sfdev2dev
> _______________________________________________
> fmpp-open mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fmpp-open
>

---------------------------------------------------------------------------=
---
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. =

Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev