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 09:53:17 +0200
| Newsgroups | gmane.comp.web.freemarker.devel |
|---|---|
| Message-ID | <CAKLdLg8tXjGvhbpLwhxQk6e29mN11P3X53v_QHpFsEhoa2ah+w@mail.gmail.com> |
2013/6/3 Daniel Dekany <[email protected]> > 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 && y`? > > > > Yes you are right. To fix this problem, XDocReport preprocess each > > XML entries to transform `x && 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) : http://xdocreport.opensagres.cloudbees.net/processReport?reportId=DocxTextStylingWithFreemarker.docx&dispatch=load&converter=PDF_XWPF > >> 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 [email protected] https://lists.sourceforge.net/lists/listinfo/freemarker-devel