Re: XDocReport, IDE support (Was: Re: Anybody with deeper OSGi bundle can comment on freemarker.jar OSGification?)
Angelo zerr <[email protected]> Tue, 4 Jun 2013 11:59:20 +0200
| Newsgroups | gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <CAKLdLg-r+afdJN8=M-D6vVkq6i4f5qBGPR=VWj2-8pJsCu0ZbQ@mail.gmail.com> |
2013/6/4 Daniel Dekany <[email protected]> > Tuesday, June 4, 2013, 9:53:17 AM, Angelo zerr wrote: > > > 2013/6/3 Daniel Dekany <[email protected]> > > 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 > [email protected] > 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 [email protected] https://lists.sourceforge.net/lists/listinfo/freemarker-devel