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.
>
> 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

Reply via email to