Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|

Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

Daniel Dekany
Starting from 2.3.20 freemarker.jar will be an OSGi bundle, however
I'm not an OSGi expert at all. So if you can comment on this, that
would be great:

https://github.com/freemarker/freemarker/blob/master/osgi.bnd

The resulting MANIFEST.MF is attached to this mail.

--
Thank you,
 Daniel Dekany
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel

MANIFEST.MF (8K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

Raymond Auge
This looks really good.

I have not tested it, but after a cursory look I don't see any issues.

- Ray


On Tue, May 21, 2013 at 6:01 AM, Daniel Dekany <[hidden email]> wrote:
Starting from 2.3.20 freemarker.jar will be an OSGi bundle, however
I'm not an OSGi expert at all. So if you can comment on this, that
would be great:

https://github.com/freemarker/freemarker/blob/master/osgi.bnd

The resulting MANIFEST.MF is attached to this mail.

--
Thank you,
 Daniel Dekany

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel




--
Raymond Augé  | Senior Software Architect | Liferay, Inc. 

---

24-25 October 2012 | Liferay Spain Symposium | liferay.com/spain2012

16 November 2012 | Liferay Italy Symposium | liferay.com/italy2012



------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

Daniel Dekany
Thanks for the feedback!

BTW, it appears that Liferay is using FreeMarker quite a bit (and you
aren't one the Powered By page). I'm saying that because I saw you are
also working on FreeMarker debugging. So, I would be interested to
hear what features you (and your users) miss the most, what issues you
want to see fixed the most, etc. As things getting more active
nowadays, now is a good time to influence the future of FM. (Sometimes
there are things that are quite easy to fix in FreeMarker, only
framework authors had to report it instead of trying to work it around
alone.)


Monday, May 27, 2013, 4:09:56 PM, Raymond Auge wrote:

> This looks really good.
>
> I have not tested it, but after a cursory look I don't see any issues.
>
> - Ray
>
>
> On Tue, May 21, 2013 at 6:01 AM, Daniel Dekany <[hidden email]> wrote:
> Starting from 2.3.20 freemarker.jar will be an OSGi bundle, however
> I'm not an OSGi expert at all. So if you can comment on this, that
> would be great:
>
> https://github.com/freemarker/freemarker/blob/master/osgi.bnd
>
> The resulting MANIFEST.MF is attached to this mail.
>
> --
> Thank you,
>  Daniel Dekany
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt!
> http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>
>
>
>

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

Raymond Auge
Hey Daniel,

Yes we use freemarker quite a lot in fact. You can do most all "templating" in Liferay in either Velocity or Freemarker.

- theme (overall look and feel of the portal/site/page)
- web content (your run-of-the-mill content templating)
- DDM (run-time entity modelling + UI templating)
- ADT (java entity UI templating, allows customizing normally static applications for java entities which implement the Liferay Asset APIs, i.e. most of all content-centric models in Liferay)
- Workflow forms (workflow engine forms/UI)

Now we are moving more and more to freemarker due to support for jsp taglibs of which we have many to make developers life easier and to automatically accommodate for concerns like behaviours, styling, and accessibility.

Velocity is a lovely template engine and has dominated Liferay mostly 'till now. It's a slightly easier dialect for non-java programmers.

However, we have supported freemarker for several years and as we move more toward standardized UI modelling we want to use more tags.

Freemarker is the natural choice. (Note our template engine is entirely plugable which makes adding new template languages very simple).

You may have noticed I have CC'd Greg Amerson who is our tooling guru, the same who is working on the freemarker debugging you have read about.

@Greg, I'd like you to meet Daniel Dekany the lead developer of Freemarker.

So, my thoughts on the needs of developers with respect to freemarker are honestly not so many :). 

In terms of language features/dialect I know of none at the moment which are jumping out at me.

Perhaps as we rely more and more on it, performance will become more of a concern. This is not because Freemarker does not perform well. Simply our utilization is often so high that we have to do deep introspection into libraries we use to eke out every last drop of performance out of them. 

I can see our performance guy now (whom I've also CC'd, @Shuyang: Be gentle!). He may point at Freemarker in the future. But it would be preemptive to try to say if/where exactly any change might be required. At one point it might be interesting if Freemarker engine might take advantage of VM features like method handles and/or invokedynamic, perhaps it already does. We may be able to donate efforts toward performance optimizations if it comes down to it and you are amenable to accepting those.

So, we come to debugging. Perhaps Greg could speak to that topic. Maybe he has ideas for improving the debugging support. Note he is currently residing in China so his feedback may be delayed.

Finally, thanks for reaching out to us Daniel.

Sincerely,
- Ray


On Fri, May 31, 2013 at 5:40 AM, Daniel Dekany <[hidden email]> wrote:
Thanks for the feedback!

BTW, it appears that Liferay is using FreeMarker quite a bit (and you
aren't one the Powered By page). I'm saying that because I saw you are
also working on FreeMarker debugging. So, I would be interested to
hear what features you (and your users) miss the most, what issues you
want to see fixed the most, etc. As things getting more active
nowadays, now is a good time to influence the future of FM. (Sometimes
there are things that are quite easy to fix in FreeMarker, only
framework authors had to report it instead of trying to work it around
alone.)


Monday, May 27, 2013, 4:09:56 PM, Raymond Auge wrote:

> This looks really good.
>
> I have not tested it, but after a cursory look I don't see any issues.
>
> - Ray
>
>
> On Tue, May 21, 2013 at 6:01 AM, Daniel Dekany <[hidden email]> wrote:
> Starting from 2.3.20 freemarker.jar will be an OSGi bundle, however
> I'm not an OSGi expert at all. So if you can comment on this, that
> would be great:
>
> https://github.com/freemarker/freemarker/blob/master/osgi.bnd
>
> The resulting MANIFEST.MF is attached to this mail.
>
> --
> Thank you,
>  Daniel Dekany
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt!
> http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>
>
>
>

--
Thanks,
 Daniel Dekany




--
Raymond Augé (@rotty3000)
Senior Software Architect
Liferay, Inc. (@Liferay)


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

angelozerr
Hi everybody,

@Daniel : for OSGi topic, it seems your bnd is good. We use Freemarker with XDocReport which is Java reporting tool (you design your report with MS Word or OpenOffice and you use Velocity/Freemarker syntax to replace simple, list value) and generate docx or odt report (and convert it with PDF or XHTML) (Daniel, you can add XDocReport to the Powered By if you are agree, thank's!). We have an Eclipse RCP/RAP demo (which works on OSGi context) and in this demo we use the com.springsource.freemarker bundles and the MANIFEST.MF looks like your bnd. 

It's out of scope of this post, but I think it should really cool if Freemarker could be hosted on the central maven repository (like springsource have done). Many project uses Maven (we use it in XDocReport) and I could simply switch  to the "official" Freemarker dependency. 

@Debugging feature : I think today Freemarker is very mature and stable, but I think tooling about Freemarker misses. It exists a JBoss Freemarker plugins but I think we can do better than this plugin like managing debugger, preview, etc. I had started this work with Eclipse DLTK at http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/ You can see doc at http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/docs/
and for debug I have used the Debugger Freemarker to manage DBGP protocol.

But I have gaven my work because of the Freemarker parser which is not tolerant (it crashes as soon as it  finds an error). With editor context, parser must be tolerant (to build an AST even if there are errors).

IMHO, I think Freemarker should be improved  for tools support like :

 * manage tolerant parser.
 * improve debugger (like DBGP debugger).

Regards Angelo


2013/5/31 Raymond Auge <[hidden email]>
Hey Daniel,

Yes we use freemarker quite a lot in fact. You can do most all "templating" in Liferay in either Velocity or Freemarker.

- theme (overall look and feel of the portal/site/page)
- web content (your run-of-the-mill content templating)
- DDM (run-time entity modelling + UI templating)
- ADT (java entity UI templating, allows customizing normally static applications for java entities which implement the Liferay Asset APIs, i.e. most of all content-centric models in Liferay)
- Workflow forms (workflow engine forms/UI)

Now we are moving more and more to freemarker due to support for jsp taglibs of which we have many to make developers life easier and to automatically accommodate for concerns like behaviours, styling, and accessibility.

Velocity is a lovely template engine and has dominated Liferay mostly 'till now. It's a slightly easier dialect for non-java programmers.

However, we have supported freemarker for several years and as we move more toward standardized UI modelling we want to use more tags.

Freemarker is the natural choice. (Note our template engine is entirely plugable which makes adding new template languages very simple).

You may have noticed I have CC'd Greg Amerson who is our tooling guru, the same who is working on the freemarker debugging you have read about.

@Greg, I'd like you to meet Daniel Dekany the lead developer of Freemarker.

So, my thoughts on the needs of developers with respect to freemarker are honestly not so many :). 

In terms of language features/dialect I know of none at the moment which are jumping out at me.

Perhaps as we rely more and more on it, performance will become more of a concern. This is not because Freemarker does not perform well. Simply our utilization is often so high that we have to do deep introspection into libraries we use to eke out every last drop of performance out of them. 

I can see our performance guy now (whom I've also CC'd, @Shuyang: Be gentle!). He may point at Freemarker in the future. But it would be preemptive to try to say if/where exactly any change might be required. At one point it might be interesting if Freemarker engine might take advantage of VM features like method handles and/or invokedynamic, perhaps it already does. We may be able to donate efforts toward performance optimizations if it comes down to it and you are amenable to accepting those.

So, we come to debugging. Perhaps Greg could speak to that topic. Maybe he has ideas for improving the debugging support. Note he is currently residing in China so his feedback may be delayed.

Finally, thanks for reaching out to us Daniel.

Sincerely,
- Ray


On Fri, May 31, 2013 at 5:40 AM, Daniel Dekany <[hidden email]> wrote:
Thanks for the feedback!

BTW, it appears that Liferay is using FreeMarker quite a bit (and you
aren't one the Powered By page). I'm saying that because I saw you are
also working on FreeMarker debugging. So, I would be interested to
hear what features you (and your users) miss the most, what issues you
want to see fixed the most, etc. As things getting more active
nowadays, now is a good time to influence the future of FM. (Sometimes
there are things that are quite easy to fix in FreeMarker, only
framework authors had to report it instead of trying to work it around
alone.)


Monday, May 27, 2013, 4:09:56 PM, Raymond Auge wrote:

> This looks really good.
>
> I have not tested it, but after a cursory look I don't see any issues.
>
> - Ray
>
>
> On Tue, May 21, 2013 at 6:01 AM, Daniel Dekany <[hidden email]> wrote:
> Starting from 2.3.20 freemarker.jar will be an OSGi bundle, however
> I'm not an OSGi expert at all. So if you can comment on this, that
> would be great:
>
> https://github.com/freemarker/freemarker/blob/master/osgi.bnd
>
> The resulting MANIFEST.MF is attached to this mail.
>
> --
> Thank you,
>  Daniel Dekany
> ------------------------------------------------------------------------------
> Try New Relic Now & We'll Send You this Cool Shirt
> New Relic is the only SaaS-based application performance monitoring service
> that delivers powerful full stack analytics. Optimize and monitor your
> browser, app, & servers with just a few lines of code. Try New Relic
> and get this awesome Nerd Life shirt!
> http://p.sf.net/sfu/newrelic_d2d_may
> _______________________________________________
> FreeMarker-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/freemarker-devel
>
>
>
>

--
Thanks,
 Daniel Dekany




--
Raymond Augé (@rotty3000)
Senior Software Architect
Liferay, Inc. (@Liferay)


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel



------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

Daniel Dekany
Monday, June 3, 2013, 1:21:04 AM, Angelo zerr wrote:

> Hi everybody,
>
> @Daniel : for OSGi topic, it seems your bnd is good. We use
> Freemarker with XDocReport which is Java reporting tool (you design
> your report with MS Word or OpenOffice and you use
> Velocity/Freemarker syntax to replace simple, list value) and
> generate docx or odt report (and convert it with PDF or XHTML)
> (Daniel, you can add XDocReport to the Powered By if you are agree,
> thank's!).

Sure. You should provide a project description, less than 250
characters.

Any ideas that would make FreeMarker a better fit for these kind of
templates that you enter right into Word/LO?

> We have an Eclipse RCP/RAP demo (which works on OSGi
> context) and in this demo we use the com.springsource.freemarker
> bundles and the MANIFEST.MF looks like your bnd.
>
> It's out of scope of this post, but I think it should really cool if
> Freemarker could be hosted on the central maven repository (like
> springsource have done). Many project uses Maven (we use it in
> XDocReport) and I could simply switch to the "official" Freemarker
> dependency.

But it's on the Central Maven Repository for a long time. Or what do
you mean?

<dependency>
  <groupId>org.freemarker</groupId>
  <artifactId>freemarker</artifactId>
  <version>...</version>
</dependency>

> @Debugging feature : I think today Freemarker is very mature and
> stable, but I think tooling about Freemarker misses.

Yes, better tooling would mean a lot to FreeMarker. I was rather
unhappy about all that happened with your work on the DLTK plugin due
to the cancelling of FM3.

> It exists a JBoss Freemarker plugins but I think we can do better
> than this plugin like managing debugger, preview, etc. I had started
> this work with Eclipse DLTK at
> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/
> You can see doc at
> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/docs/
> and for debug I have used the Debugger Freemarker to manage DBGP protocol.
>
> But I have gaven my work because of the Freemarker parser which is
> not tolerant (it crashes as soon as it  finds an error). With editor
> context, parser must be tolerant (to build an AST even if there are errors).

Was that also a problem with FM 3? Anyway, if you still want to work
on that plugin, we could revive this topic, and then I could do
something about it. Something that this time makes into a release.

> IMHO, I think Freemarker should be improved  for tools support like :
>
>  * manage tolerant parser.
>  * improve debugger (like DBGP debugger).
>
> Regards Angelo

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?

angelozerr
Hi Daniel

Sure. You should provide a project description, less than 250
>characters.

Ok I will send you that.

>Any ideas that would make FreeMarker a better fit for these kind of
>templates that you enter right into Word/LO?
docx/odt are a zip which contains several XML entries (ex: for docx word/document.xml, for odt content.xml)
XDocReport unzip docx/odt and load some XML entries ( word/document.xml, for odt content.xml) with Freemarker.
So we have a Template instance for some XML entries. When report must be generated, XDocReport uses Freemarker to merge
XML entries with Java context and create a new zip with XML entries merged.
Freemarker works great.

The only thing that I don't like is our extractor fields feature (it extract Freemarker fields name from docx).See method extractVariables https://code.google.com/p/xdocreport/source/browse/template/fr.opensagres.xdocreport.template.freemarker/src/main/java/fr/opensagres/xdocreport/template/freemarker/FreemarkerTemplateEngine.java

I find this code is awfull:

if ( DOLLAR_VARIABLE.equals( templateElement.getClass().getSimpleName() ) )

> But it's on the Central Maven Repository for a long time. Or what do
>you mean?
yes you are right, but it doesn't support OSGi.

Yes, better tooling would mean a lot to FreeMarker.
cool.

Was that also a problem with FM 3?
Jonathan Revusky told me that it's possible to manage tolerant parser with FreeCC, but he has gaven Freemarker.
I have not time to study FreeCC and I would like find people who are interested to help me to develop DLTK Freemarker.

An other idea that I had had, is to manage Freemarker with CodeMirro( Javascript editor which manages any mode). I have works a lot with CodeMirror for completion and syntax error.
For instance you can find sample with Velocity http://codemirror-java.opensagres.cloudbees.net/velocity.html the syntax error is managed on server side. We could do the same thing with Freemarker and better manage debugging feature.

Regards Angelo





2013/6/3 Daniel Dekany <[hidden email]>
Monday, June 3, 2013, 1:21:04 AM, Angelo zerr wrote:

> Hi everybody,
>
> @Daniel : for OSGi topic, it seems your bnd is good. We use
> Freemarker with XDocReport which is Java reporting tool (you design
> your report with MS Word or OpenOffice and you use
> Velocity/Freemarker syntax to replace simple, list value) and
> generate docx or odt report (and convert it with PDF or XHTML)
> (Daniel, you can add XDocReport to the Powered By if you are agree,
> thank's!).

Sure. You should provide a project description, less than 250
characters.

Any ideas that would make FreeMarker a better fit for these kind of
templates that you enter right into Word/LO?

> We have an Eclipse RCP/RAP demo (which works on OSGi
> context) and in this demo we use the com.springsource.freemarker
> bundles and the MANIFEST.MF looks like your bnd.
>
> It's out of scope of this post, but I think it should really cool if
> Freemarker could be hosted on the central maven repository (like
> springsource have done). Many project uses Maven (we use it in
> XDocReport) and I could simply switch to the "official" Freemarker
> dependency.

But it's on the Central Maven Repository for a long time. Or what do
you mean?

<dependency>
  <groupId>org.freemarker</groupId>
  <artifactId>freemarker</artifactId>
  <version>...</version>
</dependency>

> @Debugging feature : I think today Freemarker is very mature and
> stable, but I think tooling about Freemarker misses.

Yes, better tooling would mean a lot to FreeMarker. I was rather
unhappy about all that happened with your work on the DLTK plugin due
to the cancelling of FM3.

> It exists a JBoss Freemarker plugins but I think we can do better
> than this plugin like managing debugger, preview, etc. I had started
> this work with Eclipse DLTK at
> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/
> You can see doc at
> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/docs/
> and for debug I have used the Debugger Freemarker to manage DBGP protocol.
>
> But I have gaven my work because of the Freemarker parser which is
> not tolerant (it crashes as soon as it  finds an error). With editor
> context, parser must be tolerant (to build an AST even if there are errors).

Was that also a problem with FM 3? Anyway, if you still want to work
on that plugin, we could revive this topic, and then I could do
something about it. Something that this time makes into a release.

> IMHO, I think Freemarker should be improved  for tools support like :
>
>  * manage tolerant parser.
>  * improve debugger (like DBGP debugger).
>
> Regards Angelo

--
Thanks,
 Daniel Dekany



------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

Daniel Dekany
Monday, June 3, 2013, 11:16:59 AM, Angelo zerr wrote:

> Hi Daniel
>
>> Sure. You should provide a project description, less than 250
>>characters.
>
> Ok I will send you that.
>
>>Any ideas that would make FreeMarker a better fit for these kind of
>>templates that you enter right into Word/LO?
> docx/odt are a zip which contains several XML entries (ex: for docx
> word/document.xml, for odt content.xml)
> XDocReport unzip docx/odt and load some XML entries (
> word/document.xml, for odt content.xml) with Freemarker.
> So we have a Template instance for some XML entries. When report
> must be generated, XDocReport uses Freemarker to merge
> XML entries with Java context and create a new zip with XML entries merged.
> Freemarker works great.

I mostly meant issues with FreeMarker that has effect on the end-user.
Like if FreeMarker could to this-and-that, then you could add
this-and-that extra feature, or the end user wouldn't run into certain
error repeatedly, or at least would understand easier what's going
on... etc.

For example, what happens if the users enters `x && y`? Won't Word/OO
corrupt that to `x &amp;&amp; y`?

> The only thing that I don't like is our extractor fields feature
> (it extract Freemarker fields name from docx).See method
> extractVariables
> https://code.google.com/p/xdocreport/source/browse/template/fr.opensagres.xdocreport.template.freemarker/src/main/java/fr/opensagres/xdocreport/template/freemarker/FreemarkerTemplateEngine.java
>
> I find this code is awfull:
>
> if ( DOLLAR_VARIABLE.equals(
> templateElement.getClass().getSimpleName() ) )

You mean, the problem here is that the AST is not (fully) exposed
through a public API. Well... once it's exposed, we have backward
compatibility constraints there too (and BC is already a very
problematic roadblock for FM). So at the very least the parser had to
be cleaned up before that. (Or maybe, it should remain internal, but
with some public tooling API that lets you traverse a higher level
view of the template, hiding some of the implementation details.
Although keeping that up to date is a lot fiddling in itself.)

Otherwise I don't 100% get what that part does. You extract the the
expression from inside the ${...} and make it the name of a filed. But
if I have `${1 + x}` then will the field name will be "1 + x", which
is maybe unintended.

And does the user really have to create a field to enter an
interpolation, or can he just enter ${expression} anywhere? (The point
of ${expression} instead of the $varName of Velocity is that ${...} is
a safe enough delimiter in itself in most applications.)

>> But it's on the Central Maven Repository for a long time. Or what do
>>you mean?
> yes you are right, but it doesn't support OSGi.

Of course, starting from 2.3.20, the Maven artifact will be an OSGi
bundle.

>> Yes, better tooling would mean a lot to FreeMarker.
> cool.
>
>> Was that also a problem with FM 3?
> Jonathan Revusky told me that it's possible to manage tolerant
> parser with FreeCC, but he has gaven Freemarker.
> I have not time to study FreeCC and I would like find people who
> are interested to help me to develop DLTK Freemarker.

He has also gave up on FreeCC as far as I know. But I suppose it can
be implemented with JavaCC too.

> An other idea that I had had, is to manage Freemarker with
> CodeMirro( Javascript editor which manages any mode). I have works a
> lot with CodeMirror for completion and syntax error.
> For instance you can find sample with Velocity
> http://codemirror-java.opensagres.cloudbees.net/velocity.html the
> syntax error is managed on server side. We could do the same thing
> with Freemarker and better manage debugging feature.

BTW, does Velocity have an error-tolerant AST builder?

> Regards Angelo
>
>
>
>
>
> 2013/6/3 Daniel Dekany <[hidden email]>
> Monday, June 3, 2013, 1:21:04 AM, Angelo zerr wrote:
>
>> Hi everybody,
>>
>> @Daniel : for OSGi topic, it seems your bnd is good. We use
>> Freemarker with XDocReport which is Java reporting tool (you design
>> your report with MS Word or OpenOffice and you use
>> Velocity/Freemarker syntax to replace simple, list value) and
>> generate docx or odt report (and convert it with PDF or XHTML)
>> (Daniel, you can add XDocReport to the Powered By if you are agree,
>> thank's!).
>
> Sure. You should provide a project description, less than 250
> characters.
>
> Any ideas that would make FreeMarker a better fit for these kind of
> templates that you enter right into Word/LO?
>
>> We have an Eclipse RCP/RAP demo (which works on OSGi
>> context) and in this demo we use the com.springsource.freemarker
>> bundles and the MANIFEST.MF looks like your bnd.
>>
>> It's out of scope of this post, but I think it should really cool if
>> Freemarker could be hosted on the central maven repository (like
>> springsource have done). Many project uses Maven (we use it in
>> XDocReport) and I could simply switch to the "official" Freemarker
>> dependency.
>
> But it's on the Central Maven Repository for a long time. Or what do
> you mean?
>
> <dependency>
>   <groupId>org.freemarker</groupId>
>   <artifactId>freemarker</artifactId>
>   <version>...</version>
> </dependency>
>
>> @Debugging feature : I think today Freemarker is very mature and
>> stable, but I think tooling about Freemarker misses.
>
> Yes, better tooling would mean a lot to FreeMarker. I was rather
> unhappy about all that happened with your work on the DLTK plugin due
> to the cancelling of FM3.
>
>> It exists a JBoss Freemarker plugins but I think we can do better
>> than this plugin like managing debugger, preview, etc. I had started
>> this work with Eclipse DLTK at
>> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/
>> You can see doc at
>> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/docs/
>> and for debug I have used the Debugger Freemarker to manage DBGP protocol.
>>
>> But I have gaven my work because of the Freemarker parser which is
>> not tolerant (it crashes as soon as it  finds an error). With editor
>> context, parser must be tolerant (to build an AST even if there are errors).
>
> Was that also a problem with FM 3? Anyway, if you still want to work
> on that plugin, we could revive this topic, and then I could do
> something about it. Something that this time makes into a release.
>
>> IMHO, I think Freemarker should be improved  for tools support like :
>>
>>  * manage tolerant parser.
>>  * improve debugger (like DBGP debugger).
>>
>> Regards Angelo
>
> --
> Thanks,
>  Daniel Dekany
>
>

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

angelozerr



2013/6/3 Daniel Dekany <[hidden email]>
Monday, June 3, 2013, 11:16:59 AM, Angelo zerr wrote:

> Hi Daniel
>
>> Sure. You should provide a project description, less than 250
>>characters.
>
> Ok I will send you that.
>
>>Any ideas that would make FreeMarker a better fit for these kind of
>>templates that you enter right into Word/LO?
> docx/odt are a zip which contains several XML entries (ex: for docx
> word/document.xml, for odt content.xml)
> XDocReport unzip docx/odt and load some XML entries (
> word/document.xml, for odt content.xml) with Freemarker.
> So we have a Template instance for some XML entries. When report
> must be generated, XDocReport uses Freemarker to merge
> XML entries with Java context and create a new zip with XML entries merged.
> Freemarker works great.

I mostly meant issues with FreeMarker that has effect on the end-user.
Like if FreeMarker could to this-and-that, then you could add
this-and-that extra feature, or the end user wouldn't run into certain
error repeatedly, or at least would understand easier what's going
on... etc.

For example, what happens if the users enters `x && y`? Won't Word/OO
corrupt that to `x &amp;&amp; y`?

Yes you are right. To fix this problem, XDocReport preprocess each XML entries to transform  `x &amp;&amp; y` to `x && y`
before loading it in the Freemarker Template.
 
> The only thing that I don't like is our extractor fields feature
> (it extract Freemarker fields name from docx).See method
> extractVariables
> https://code.google.com/p/xdocreport/source/browse/template/fr.opensagres.xdocreport.template.freemarker/src/main/java/fr/opensagres/xdocreport/template/freemarker/FreemarkerTemplateEngine.java
>
> I find this code is awfull:
>
> if ( DOLLAR_VARIABLE.equals(
> templateElement.getClass().getSimpleName() ) )

You mean, the problem here is that the AST is not (fully) exposed
through a public API. Well... once it's exposed, we have backward
compatibility constraints there too (and BC is already a very
problematic roadblock for FM). So at the very least the parser had to
be cleaned up before that. (Or maybe, it should remain internal, but
with some public tooling API that lets you traverse a higher level
view of the template, hiding some of the implementation details.
Although keeping that up to date is a lot fiddling in itself.)

Otherwise I don't 100% get what that part does. You extract the the
expression from inside the ${...} and make it the name of a filed. But
if I have `${1 + x}` then will the field name will be "1 + x", which
is maybe unintended.

Fields extractor is very basic. If you have `${1 + x}`, field name will be 1 + x (and not x).
But fields extractor was developped just to upload a docx and retrieves fields.See demo at http://xdocreport.opensagres.cloudbees.net/loadReport.jsp
 

And does the user really have to create a field to enter an
interpolation, or can he just enter ${expression} anywhere? (The point
of ${expression} instead of the $varName of Velocity is that ${...} is
a safe enough delimiter in itself in most applications.)

It must create a field to enter an interpolation or directive. Why? Because docx and odt doesn't escape the typed content that you set in a field.

If you are interested, you can play with our online demo  http://xdocreport.opensagres.cloudbees.net/index.jsp

>> But it's on the Central Maven Repository for a long time. Or what do
>>you mean?
> yes you are right, but it doesn't support OSGi.

Of course, starting from 2.3.20, the Maven artifact will be an OSGi
bundle.

Great! We will switch to it.
 

>> Yes, better tooling would mean a lot to FreeMarker.
> cool.
>
>> Was that also a problem with FM 3?
> Jonathan Revusky told me that it's possible to manage tolerant
> parser with FreeCC, but he has gaven Freemarker.
> I have not time to study FreeCC and I would like find people who
> are interested to help me to develop DLTK Freemarker.

He has also gave up on FreeCC as far as I know. But I suppose it can
be implemented with JavaCC too.

Perhaps, but the question is who can do that?
 

> An other idea that I had had, is to manage Freemarker with
> CodeMirro( Javascript editor which manages any mode). I have works a
> lot with CodeMirror for completion and syntax error.
> For instance you can find sample with Velocity
> http://codemirror-java.opensagres.cloudbees.net/velocity.html the
> syntax error is managed on server side. We could do the same thing
> with Freemarker and better manage debugging feature.

BTW, does Velocity have an error-tolerant AST builder?

I think it's the same problem than Freemarker. You can see it in my demo http://codemirror-java.opensagres.cloudbees.net/velocity.html 
The editor displays just one error even (the first found error) even if they are several errors.

> Regards Angelo
>
>
>
>
>
> 2013/6/3 Daniel Dekany <[hidden email]>
> Monday, June 3, 2013, 1:21:04 AM, Angelo zerr wrote:
>
>> Hi everybody,
>>
>> @Daniel : for OSGi topic, it seems your bnd is good. We use
>> Freemarker with XDocReport which is Java reporting tool (you design
>> your report with MS Word or OpenOffice and you use
>> Velocity/Freemarker syntax to replace simple, list value) and
>> generate docx or odt report (and convert it with PDF or XHTML)
>> (Daniel, you can add XDocReport to the Powered By if you are agree,
>> thank's!).
>
> Sure. You should provide a project description, less than 250
> characters.
>
> Any ideas that would make FreeMarker a better fit for these kind of
> templates that you enter right into Word/LO?
>
>> We have an Eclipse RCP/RAP demo (which works on OSGi
>> context) and in this demo we use the com.springsource.freemarker
>> bundles and the MANIFEST.MF looks like your bnd.
>>
>> It's out of scope of this post, but I think it should really cool if
>> Freemarker could be hosted on the central maven repository (like
>> springsource have done). Many project uses Maven (we use it in
>> XDocReport) and I could simply switch to the "official" Freemarker
>> dependency.
>
> But it's on the Central Maven Repository for a long time. Or what do
> you mean?
>
> <dependency>
>   <groupId>org.freemarker</groupId>
>   <artifactId>freemarker</artifactId>
>   <version>...</version>
> </dependency>
>
>> @Debugging feature : I think today Freemarker is very mature and
>> stable, but I think tooling about Freemarker misses.
>
> Yes, better tooling would mean a lot to FreeMarker. I was rather
> unhappy about all that happened with your work on the DLTK plugin due
> to the cancelling of FM3.
>
>> It exists a JBoss Freemarker plugins but I think we can do better
>> than this plugin like managing debugger, preview, etc. I had started
>> this work with Eclipse DLTK at
>> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/
>> You can see doc at
>> http://sourceforge.net/p/freemarker/code/HEAD/tree/sandbox/org.eclipse.dltk.freemarker/docs/
>> and for debug I have used the Debugger Freemarker to manage DBGP protocol.
>>
>> But I have gaven my work because of the Freemarker parser which is
>> not tolerant (it crashes as soon as it  finds an error). With editor
>> context, parser must be tolerant (to build an AST even if there are errors).
>
> Was that also a problem with FM 3? Anyway, if you still want to work
> on that plugin, we could revive this topic, and then I could do
> something about it. Something that this time makes into a release.
>
>> IMHO, I think Freemarker should be improved  for tools support like :
>>
>>  * manage tolerant parser.
>>  * improve debugger (like DBGP debugger).
>>
>> Regards Angelo
>
> --
> Thanks,
>  Daniel Dekany
>
>

--
Thanks,
 Daniel Dekany



------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

Daniel Dekany
Monday, June 3, 2013, 2:29:45 PM, Angelo zerr wrote:

[snip]
>> For example, what happens if the users enters `x && y`? Won't Word/OO
>> corrupt that to `x &amp;&amp; y`?
>
> Yes you are right. To fix this problem, XDocReport preprocess each
> XML entries to transform  `x &amp;&amp; y` to `x && y`
> before loading it in the Freemarker Template.

You mean it already does that. (I suppose it's smart enough to do it
only inside the FreeMarker directives and interpolations or else it
would corrupt the XML.)

[snip]
> It must create a field to enter an interpolation or directive. Why?
> Because docx and odt doesn't escape the typed content that you set in a field.

You said you un-escape the FTL parts, so what do you mean by
"escaped"? From use perspective it's maybe needless complication,
creating a field, and then also delimit its content with ${...}. I
don't want to be difficult here, just trying to figure out what would
be needed for this on FreeMarker's side, if anything...

> If you are interested, you can play with our online demo
> http://xdocreport.opensagres.cloudbees.net/index.jsp

[snip]

>> Of course, starting from 2.3.20, the Maven artifact will be an OSGi
>> bundle.
>>
> Great! We will switch to it.

(I have almost renamed DollarVariable to DollarInterpolation, it being
a non-public class. Then after I saw that code earlier, I have
realized it would break XDocReport... and who knows what else.)

>> He has also gave up on FreeCC as far as I know. But I suppose it can
>> be implemented with JavaCC too.
>
> Perhaps, but the question is who can do that?

There's a high chance that *if* anyone will do that, that will be me.
Although I have to say that I don't know yet how difficult that will
be...

>> An other idea that I had had, is to manage Freemarker with
>> CodeMirro( Javascript editor which manages any mode). I have works a
>> lot with CodeMirror for completion and syntax error.

Of course, anything that (properly) supports FreeMarker is a good
thing as far as I'm concerned...

>> For instance you can find sample with Velocity
>> http://codemirror-java.opensagres.cloudbees.net/velocity.html the
>> syntax error is managed on server side. We could do the same thing

>> BTW, does Velocity have an error-tolerant AST builder?
>
> I think it's the same problem than Freemarker. You can see it in my
> demo http://codemirror-java.opensagres.cloudbees.net/velocity.html 
> The editor displays just one error even (the first found error) even if they are several errors.

I think that's alone isn't a that big issue. The user can fix the
errors as they pop up, until there's none, and that's it. So is this
really a blocking issue for the DLTK-based plugin?

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite
It's a free troubleshooting tool designed for production
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://p.sf.net/sfu/appdyn_d2d_ap2
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

angelozerr



2013/6/3 Daniel Dekany <[hidden email]>
Monday, June 3, 2013, 2:29:45 PM, Angelo zerr wrote:

[snip]
>> For example, what happens if the users enters `x && y`? Won't Word/OO
>> corrupt that to `x &amp;&amp; y`?
>
> Yes you are right. To fix this problem, XDocReport preprocess each
> XML entries to transform  `x &amp;&amp; y` to `x && y`
> before loading it in the Freemarker Template.

You mean it already does that. (I suppose it's smart enough to do it
only inside the FreeMarker directives and interpolations or else it
would corrupt the XML.)

Interpolation, Directive etc must be inserted in a docx mergefield  /odt input field. The preprocessing is done
just for mergefield/input field.


[snip]
> It must create a field to enter an interpolation or directive. Why?
> Because docx and odt doesn't escape the typed content that you set in a field.

You said you un-escape the FTL parts, so what do you mean by
"escaped"? From use perspective it's maybe needless complication,
creating a field, and then also delimit its content with ${...}. I
don't want to be difficult here, just trying to figure out what would
be needed for this on FreeMarker's side, if anything...
Ok sorry I'm not clear.

When you type some content in a docx, MS word split your content in several xml elements.
For instance if you type :

--------------------------------------------------- 
${name}
---------------------------------------------------

The word/document.xml looks like this :

---------------------------------------------------
<t>${</t>name}</t>
---------------------------------------------------

Freemarker can do nothing with that. A solution could be done with a preprocessing to transform like this :

---------------------------------------------------
<t>${name}</t>
---------------------------------------------------

I have done that with pptx but it's very bugged. The elegant solution is to use mergefield/input filed, because the xml is like this :

---------------------------------------------------
<t><field>${name}</field></t>
---------------------------------------------------

The preprocessing removes just the field element to have:

---------------------------------------------------
<t>${name}</t>
---------------------------------------------------


> If you are interested, you can play with our online demo
> http://xdocreport.opensagres.cloudbees.net/index.jsp

[snip]

>> Of course, starting from 2.3.20, the Maven artifact will be an OSGi
>> bundle.
>>
> Great! We will switch to it.

(I have almost renamed DollarVariable to DollarInterpolation, it being
a non-public class. Then after I saw that code earlier, I have
realized it would break XDocReport... and who knows what else.)

As XDocReport  is modular, we can create an other project for that. So no problem if you break the API.

>> He has also gave up on FreeCC as far as I know. But I suppose it can
>> be implemented with JavaCC too.
>
> Perhaps, but the question is who can do that?

There's a high chance that *if* anyone will do that, that will be me.
Although I have to say that I don't know yet how difficult that will
be...
Ok

>> An other idea that I had had, is to manage Freemarker with
>> CodeMirro( Javascript editor which manages any mode). I have works a
>> lot with CodeMirror for completion and syntax error.

Of course, anything that (properly) supports FreeMarker is a good
thing as far as I'm concerned...

Ok. And if we do that, you could host an online demo in order to future users can play with FM syntax with online demo. 
You could have a JSON editor + FM editor. As soon as you modify it, you could see the FM preview. 
On other words, do the same thing than our demo (generate reports + convert it to pdf as soon as you change the HTML model)  :


>> For instance you can find sample with Velocity
>> http://codemirror-java.opensagres.cloudbees.net/velocity.html the
>> syntax error is managed on server side. We could do the same thing

>> BTW, does Velocity have an error-tolerant AST builder?
>
> I think it's the same problem than Freemarker. You can see it in my
> demo http://codemirror-java.opensagres.cloudbees.net/velocity.html
> The editor displays just one error even (the first found error) even if they are several errors.

I think that's alone isn't a that big issue. The user can fix the
errors as they pop up, until there's none, and that's it. So is this
really a blocking issue for the DLTK-based plugin?
Its a long time that I have developped  Freemarker-DLTK, but if I remember DLTK needs to maintain 
a DLTK AST even if the editor breaks the FM AST. (As soon as you type text in the editor, I called
the FM AST to create a DLTK AST). The DLTK AST is used for instance for the Outline View to display elements of FM (#list, etc)

Today I'm very busy, but if some people are interested with DLTK Freemarker, I could try to restart it (uses the last version of DLTK, etc).

Regards Angelo

--
Thanks,
 Daniel Dekany



------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

Daniel Dekany
Tuesday, June 4, 2013, 9:53:17 AM, Angelo zerr wrote:

> 2013/6/3 Daniel Dekany <[hidden email]>
> Monday, June 3, 2013, 2:29:45 PM, Angelo zerr wrote:
[snip]

> When you type some content in a docx, MS word split your content in several xml elements.
> For instance if you type :
>
> ---------------------------------------------------
> ${name}
> ---------------------------------------------------
>
> The word/document.xml looks like this :
>
> ---------------------------------------------------
> <t>${</t>name}</t>
> ---------------------------------------------------

Aha, I see. I wonder what's the *generic* solution for this, one that
could be used in multiple projects. You had to get rid of all the tags
then un-escape, and in the resulting "plain text" find the template
language elements, then in the XML document you had to remove all the
elements inside and move out all the element "edges" from the
corresponding section, then replace the now cleared section with the
plain text version. Then execute the resulting template, which will
produce an XML, that you might want to transform further because there
can be elements in it, like <fm:repeatParent element="wm:tableRow">
... </fm:repeatParent> that should find the parent "wm:taleRow" and
repeat it once for each nested fm:repeatParent, with the contents of
the fm:parentContent element. Stuff like that. Obviously not part of
plain FreeMarker, but could be in a generally useful library.

> Ok. And if we do that, you could host an online demo in order to
> future users can play with FM syntax with online demo.
> You could have a JSON editor + FM editor. As soon as you modify it, you could see the FM preview.

Oh, that would be very cool. Although running arbitrary user-specified
FTL on a server is a bit too brave (see FAQ about precautions)...
unless it runs in some discardable VPS. But it could be done with an
applet running on the client too, and then he can only hack himself.

> On other words, do the same thing than our demo (generate reports +
> convert it to pdf as soon as you change the HTML model)  :
> http://xdocreport.opensagres.cloudbees.net/processReport?reportId=DocxTextStylingWithFreemarker.docx&dispatch=load&converter=PDF_XWPF

[snip]
> Its a long time that I have developped  Freemarker-DLTK, but if I remember DLTK needs to maintain
> a DLTK AST even if the editor breaks the FM AST. (As soon as you type text in the editor, I called
> the FM AST to create a DLTK AST). The DLTK AST is used for instance
> for the Outline View to display elements of FM (#list, etc)

How do they do this with other languages? Eclipse has its own Java
parser, and that's surely was designed with this in mind, and it's
fast too. But what about Jython, Ruby, etc? Do they use the "real"
parser, or somebody has developed a special parser just for the
Eclipse plugin?

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

angelozerr



2013/6/4 Daniel Dekany <[hidden email]>
Tuesday, June 4, 2013, 9:53:17 AM, Angelo zerr wrote:

> 2013/6/3 Daniel Dekany <[hidden email]>
> Monday, June 3, 2013, 2:29:45 PM, Angelo zerr wrote:
[snip]
> When you type some content in a docx, MS word split your content in several xml elements.
> For instance if you type :
>
> ---------------------------------------------------
> ${name}
> ---------------------------------------------------
>
> The word/document.xml looks like this :
>
> ---------------------------------------------------
> <t>${</t>name}</t>
> ---------------------------------------------------

Aha, I see. I wonder what's the *generic* solution for this, one that
could be used in multiple projects. You had to get rid of all the tags
then un-escape, and in the resulting "plain text" find the template
language elements, then in the XML document you had to remove all the
elements inside and move out all the element "edges" from the
corresponding section, then replace the now cleared section with the
plain text version. Then execute the resulting template, which will
produce an XML, that you might want to transform further because there
can be elements in it, like <fm:repeatParent element="wm:tableRow">
... </fm:repeatParent> that should find the parent "wm:taleRow" and
repeat it once for each nested fm:repeatParent, with the contents of
the fm:parentContent element. Stuff like that. Obviously not part of
plain FreeMarker, but could be in a generally useful library.

Your explanation is what XDocReport preprocessing do. We use bracket syntax in the XML.
Preprocessing manages too the start/end loop for table row because it's not possible to set the #list/#end at hand in the well location. 

> Ok. And if we do that, you could host an online demo in order to
> future users can play with FM syntax with online demo.
> You could have a JSON editor + FM editor. As soon as you modify it, you could see the FM preview.

Oh, that would be very cool. Although running arbitrary user-specified
FTL on a server is a bit too brave (see FAQ about precautions)...
unless it runs in some discardable VPS. But it could be done with an
applet running on the client too, and then he can only hack himself.

> On other words, do the same thing than our demo (generate reports +
> convert it to pdf as soon as you change the HTML model)  :
> http://xdocreport.opensagres.cloudbees.net/processReport?reportId=DocxTextStylingWithFreemarker.docx&dispatch=load&converter=PDF_XWPF

[snip]
> Its a long time that I have developped  Freemarker-DLTK, but if I remember DLTK needs to maintain
> a DLTK AST even if the editor breaks the FM AST. (As soon as you type text in the editor, I called
> the FM AST to create a DLTK AST). The DLTK AST is used for instance
> for the Outline View to display elements of FM (#list, etc)

How do they do this with other languages? Eclipse has its own Java
parser, and that's surely was designed with this in mind, and it's
fast too. But what about Jython, Ruby, etc? Do they use the "real"
parser, or somebody has developed a special parser just for the
Eclipse plugin?

For Java, it's JDT plugins which manages the java parsing. It exists several project like XText and DLTK 
which provides the capability to parse other language and build an AST.
With XText you write a grammar and after it build an EMF (Eclipse Model Framework)  instance. It uses this EMF instance 
to manage completion, syntax coloring, folding etc.

DLTK is a project to manage dynamic  language like Javascript, Ruby etc. You must write a parser which builds a DLTK AST and after 
you benefit with several features like code folding, debugging support with DBGP etc.
To create this DLTK AST, you can :

1) create your own parser to create directly the DLTK AST.
2) create a parser which uses an existing parser to build a DLTK AST.

In my case for Freemarker I have choosen the 2). The performance is less good than 1) but there are good performance and it avoids to maintain 2 FM parsing.

Regards Angelo

has taken JDT code to manage any dynamic language 

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

Daniel Dekany
Tuesday, June 4, 2013, 11:59:20 AM, Angelo zerr wrote:

[sbip]
> Your explanation is what XDocReport preprocessing do.

Certainly its not *all* the same, because then it would not require
putting interpolations into fields.

> For Java, it's JDT plugins which manages the java parsing. It
> exists several project like XText and DLTK
> which provides the capability to parse other language and build an AST.
> With XText you write a grammar and after it build an EMF (Eclipse
> Model Framework)  instance. It uses this EMF instance
> to manage completion, syntax coloring, folding etc.
>
> DLTK is a project to manage dynamic  language like Javascript, Ruby
> etc. You must write a parser which builds a DLTK AST and after
> you benefit with several features like code folding, debugging support with DBGP etc.
> To create this DLTK AST, you can :
>
> 1) create your own parser to create directly the DLTK AST.
> 2) create a parser which uses an existing parser to build a DLTK AST.
>
> In my case for Freemarker I have choosen the 2). The performance is
> less good than 1) but there are good performance and it avoids to maintain 2 FM parsing.

OK, let's consider 2) as the goal for now, and then we will see if it
a realistic goal with this JavaCC stuff we have. Yet, as plan B, is it
a standard approach that you have a special parser for the IDE, but
for the error markings you are using the production parser? Because if
the syntax coloring and outline and such errs in some edge cases (like
around the glitches in the production parser...), but still only marks
templates as error free that will not fail during parsing on the
server, that's maybe a good enough.

> Regards Angelo
>
> has taken JDT code to manage any dynamic language

--
Thanks,
 Daniel Dekany


------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel
Reply | Threaded
Open this post in threaded view
|

Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)

angelozerr

OK, let's consider 2) as the goal for now, and then we will see if it
a realistic goal with this JavaCC stuff we have. Yet, as plan B, is it
a standard approach that you have a special parser for the IDE, but
for the error markings you are using the production parser? Because if
the syntax coloring and outline and such errs in some edge cases (like
around the glitches in the production parser...), but still only marks
templates as error free that will not fail during parsing on the
server, that's maybe a good enough.

Daniel, it was very long that I have developed the Freemarker plugin, but for errors syntax I used the existing FM parser.
I'm very busy for the moment, but if some people are really interested with this plugin (to contribute too),
I will try to find time to restart it. I think it can be good too that you develop this plugin to improve the FM parser.
It will avoid writing a lot of mails and you will see the whole problems if you join in this plugin development.

Regards Angelo

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
_______________________________________________
FreeMarker-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/freemarker-devel