Thank you for your replies, PMario, Joshua and Tones.

@ Joshua: Thanks a lot for taking the time to write this comprehensive and 
clear explanation.

I have followed your solution to insert `\whitespace notrim` at the 
beginning of a tiddler text, but unfortunately, it doesn't work.

I also tried to place it into a macro like this:

```
\define mymacro()
\whitespace notrim
<$transclude field="field1" /><$transclude field="field2" />
\end
```

but in vain. In the documentation <https://tiddlywiki.com/#Pragma>, the 
default is set to 'notrim', so adding such an instruction in a macro is 
useless.


@ PMario:

I am aware of the solution you provide, but inserting a normal or 
non-breakable space between the two transclusions is not an option.

A very simplified example of what I would like to do is connecting two 
parts of something similar to a sentence together, but that sentence may 
not need a complement in the second part.
For instance:
if field1 contains: 'The cat is eating'
field2 might contain: ' a mouse.' or ' cat food.' (note the space), or '.' 
(no space required before a full stop / period).

Your solution would always insert a space, even before a punctuation sign 
such as a period or a comma...



@ Tones

Your advice is worth following 'for standard use cases'. But what I wish to 
implement is probably not an ordinary one.

You wrote:
- The spacing you wish is something best done in the display of the data 
and not in the data, what if they changed order? 

I don't understand what you mean by 'what if they changed order?'.
What would change order? The data? The fields? No, I wouldn't need to 
change their order. See my example above. Why would I need the 
'complementary' part of the data to show before the 'main' part?

As for the spacing, it is an integral part of the data here (as a word 
separator within a sencence, for instance). Therefore putting it anywhere 
else in this case wouldn't be a wise choice.

- A field containing a list of titles or tiddlers is typically space 
delimited. So we often need the leading and trailing spaces not to be 
included.

Sure, but that's not my use case. And 'often' is not 'always'! ;-)

- You can access fields in a different way if you really need to have 
leading or training spaces as part of the data

Well, that's exactly what I'm after!


> '{{{ [all[current]get[afield]] }}}'

> The transcluded filter output demonstrates the field contains a leading 
space of it has one.

That filter output is interesting. But it doesn't render HTML tags or 
Wikitext, contrary to $transclude.
If 'afield' contains: ` This is <strong>my</strong> //field//. `, 
then 
'{{{ [all[current]get[afield]] }}}'
'<$text text={{{ [all[current]get[afield]] }}} />'
'<$view field=afield />'
all render raw text as: 
' This is <strong>my</strong> //field//. '
whereas
'<$transclude field=afield/>'
renders as:
'This is *my* *field*.'

Seems that I have to trade in the leading space for formatting and 
vice-versa. Can't have my cake and eat it.

Regards,

Stéphane


-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/19c1fa23-fb11-48c6-8ee6-513a5657597cn%40googlegroups.com.

Reply via email to