Misterel,

I believe I understand what you are trying todo. Yet I would persist in 
suggesting you separate the data from its presentation. 

Of course its is fine to use the pragmatic approach as you wish.

What I would do is build the concatenation process to always include a 
space between elements, no leading or trailing spaces needed, except when 
it starts with period or any other exceptions you identify.

Basically I would get the logic to handle the language concatenation and 
leave such fiddling, outside of the data. Ideally I would even leave 
leading commas out of the data as this is again all about presentation eg 
if I have a list of three items the first is separated from the second by a 
comma the third by "and". and the full stop comes at the very end. ie just 
store the items because you need not know how you will use them in the 
future and when using them format according to the presentation. The recent 
and next version 5.2.0 contains some support for this first, seconds and 
last treatment such as with the counter variable, even css can handle this.

Experience has shown me such an approach is actually much simpler in the 
short term and few exceptions are required, where the approach you are 
taking will ultimately be the opposite, more complex and have more 
exceptions, while also loosing flexibility.

But yes you are an autonomous being :) do what you want.

Tones
On Monday, 16 August 2021 at 03:34:41 UTC+10 Misterel85 wrote:

> Yay, it works!!! Thank you very much for your quick reply and your simple 
> and straightforward solution, Eric!
> After a bit of trial and error, I could adapt it to my TiddlyWiki.
> No need for an   anymore indeed.
> Thanks again to all of you for your help, solutions, explanations and 
> suggestions.
>
> Best,
> -Stéphane
>
> Le dimanche 15 août 2021 à 18:01:55 UTC+2, Eric Shulman a écrit :
>
>> On Sunday, August 15, 2021 at 7:10:39 AM UTC-7 Misterel85 wrote:
>>
>>> I first thought there would have been a more straightforward solution to 
>>> that issue, but actually I come to think that it should be possible to 
>>> inspect the first character in the contents of field 2:
>>> If value of field2 starts with space, then insert ` ` between the 
>>> transclusions, else just proceed with both transclusions.
>>>
>>
>> Try this:
>> <$transclude field="field1"/><$text text={{{ 
>> [{!!field2}split[]first[]match[ ]] }}}/><$transclude field="field2"/>
>>
>> Notes:
>> * The {{{ [...] }}} is a "filtered transclusion"
>> * The filter starts by getting the value of the desired field, using 
>> {!!field2}
>> * It then splits that value into separate characters, using split[]
>> * Next, it gets just the first character, using first[]
>> * and compares it with a space, using match[ ]
>> * The result of the filter is either nothing, or an actual space 
>> character (not an &nbsp;)
>> * The <$text> widget then converts the output to plain text (instead of 
>> displaying a link to a space!)
>>
>> enjoy,
>> -e
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/dc56b6c3-cf1e-4a76-b865-c823bfd8923dn%40googlegroups.com.

Reply via email to