Well, I added that to my TODO. For what it's worth... because I'm so much
behind with the FM TODO. (I will probably do my year-end FM spring this
year again... Tradition at this point. But I will focus on finishing
java.time support first, and there's still a lot to do there.)

On Thu, Sep 28, 2023 at 7:22 PM Christoph Rüger <c.rue...@synesty.com>
wrote:

> Thanks to all for your feedback.
>
> Am Mi., 20. Sept. 2023 um 16:57 Uhr schrieb Daniel Dekany <
> daniel.dek...@gmail.com>:
>
> > Ah, missed the replies of others earlier. So, I think, in case of
> > ${existingVar + missingVar}, we could re-print ${existingVar +
> missingVar}
> > as is. And then, if existingVar is not there for the 2nd phase
> processing,
> > then bad luck...
> >
> > On Wed, Sep 20, 2023 at 8:53 AM Daniel Dekany <daniel.dek...@gmail.com>
> > wrote:
> >
> > > So that means that if an ${...} throws InvalidReferenceException, the
> > > TemplateExceptionHandler (see
> Configuration.setTemplateExceptionHandler)
> > > should suppress the exception, and print the source code quotation of
> the
> > > interpolation. The last is currently not supported, but maybe not that
> > hard
> > > to add.
>
>
>
> > Like, maybe, the TemplateException that we handle could provide the
> > > quotation.
> >
>
> Although we now followed a different path and discarded the initial 2-phase
> rendering idea, I like your idea for something else - if I interpret your
> sentence correctly.
> Having the "source quotation in the TemplateException" may allow us to
> provide better custom error messages.
> Don't get me wrong: the error messages of FM are often quite good and
> detailed, but having access to the source code quotation would allow us to
> create our own error messages with words more suitable to our application
> in some cases.
>
>
>
> > >
> > > What if you have ${existingVar + missingVar}?
> > >
> > > A further complication... what if the problem is in a directive, like
> > > <#if  variableB = 'x'>. I think then we have to fail the template, as
> we
> > > can't decide if the inside of the #if had to be executed now, or not.
> > Same
> > > problem with custom directives.
> > >
> > > On Mon, Sep 18, 2023 at 6:03 PM Christoph Rüger <c.rue...@synesty.com>
> > > wrote:
> > >
> > >> Hi,
> > >> we may have a rather special case and are looking for ideas.
> > >> We would like to to keep the placeholders as they are in case of null
> > >> values.
> > >>
> > >> Assume the following template:
> > >>
> > >> ${metaHeaderDataA}
> > >> ${variableB}
> > >>
> > >> We would like the following behavior:
> > >>
> > >> *1st render phase:*
> > >> data.put("metaHeaderDataA", "foo")
> > >> environment.process(template);
> > >>
> > >> Expected Output:
> > >> foo
> > >> ${variableB}
> > >>
> > >> The we want to render this output again with:
> > >>
> > >> *2nd render phase:*
> > >> data.put("variableB", "bar")
> > >> environment.process(template);
> > >>
> > >> Expected final Output:
> > >> foo
> > >> bar
> > >>
> > >> As you see there 2 two rendering phases involved. In phase 1 only some
> > >> variables are known (metaHeaderDataA).
> > >> The other variables come later.
> > >> We would like keep the placeholders in the 1st rendering phase, if
> there
> > >> is
> > >> no value or null value in the data model, so that they can be rendered
> > >> later.
> > >>
> > >> I think this is very special.
> > >> So I am just  thinking, is this something which could (theoretically)
> > be a
> > >> configurable option maybe on a per-Template-object level (Java Code)?
> Or
> > >> is
> > >> this something impossible to do?
> > >>
> > >> Or any other workaround ideas?
> > >>
> > >>
> > >> Thanks
> > >> Christoph
> > >>
> > >> --
> > >> Synesty GmbH
> > >> Berggasse 1
> > >> 07745 Jena
> > >> Tel.: +49 3641 5596493Internet:
> > >> https://synesty.com <https://synesty.com>
> > >> Informationen zum Datenschutz:
> > >> https://synesty.com/datenschutz <https://synesty.com/datenschutz>
> > >>
> > >> Geschäftsführer: Christoph Rüger
> > >> Unternehmenssitz: Jena
> > >> Handelsregister B
> > >> beim Amtsgericht: Jena
> > >> Handelsregister-Nummer: HRB 508766
> > >> Ust-IdNr.:
> > >> DE287564982
> > >>
> > >
> > >
> > > --
> > > Best regards,
> > > Daniel Dekany
> > >
> >
> >
> > --
> > Best regards,
> > Daniel Dekany
> >
>
>
> --
> Christoph Rüger, Geschäftsführer
> Synesty <https://synesty.com/> - Anbinden und Automatisieren ohne
> Programmieren
>
> --
> Synesty GmbH
> Berggasse 1
> 07745 Jena
> Tel.: +49 3641 5596493Internet:
> https://synesty.com <https://synesty.com>
> Informationen zum Datenschutz:
> https://synesty.com/datenschutz <https://synesty.com/datenschutz>
>
> Geschäftsführer: Christoph Rüger
> Unternehmenssitz: Jena
> Handelsregister B
> beim Amtsgericht: Jena
> Handelsregister-Nummer: HRB 508766
> Ust-IdNr.:
> DE287564982
>


-- 
Best regards,
Daniel Dekany

Reply via email to