Misterel
Joshua does a great technical explanation here, and Mario gives the
standard solution.
- The spacing you wish is something best done in the display of the data
and not in the data, what if they changed order?
- 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.
- Create a new tiddler and give it leading and ending spaces and you
will see how these end up trimmed and do not become part of the title.
- You can access fields in a different way if you really need to have
leading or training spaces as part of the data
- Transcluding not only brings the fields value, in but what follows is
it is rendered, I believe this is when the spaces are trimmed.
Try
'<$transclude field=afield/>' or '{{!!afield}}'
'{{{ [all[current]get[afield]] }}}'
The transcluded filter output demonstrates the field contains a leading
space of it has one.
Regards
Tones
On Sunday, 15 August 2021 at 06:28:56 UTC+10 Misterel85 wrote:
> How can I prevent TW from trimming leading space in field transclusion?
>
> When transcludings two fields one after the other, for instance:
>
> `<$transclude field="foo" /><$transclude field="bar" />`
>
> if the value of field "bar" starts with a space, that space is
> automatically removed in the transclusion.
>
> In this example the successive transclusions of:
>
> "foo"=> "This is foo"
> "bar"=> " and this is bar."
>
> render as:
>
> "This is fooand this is bar."
>
> Inserting a trailing space in "foo" or a ` ` between the two
> transclusions is not an option for me.
> Placing a ` ` at the beginning of the value in the second transcluded
> field works, but that's a bit of a hassle with multiple transclusions.
>
> Why does TW behave so and what is needed to achieve the result I am
> looking for (a kind of 'untrim' operator)?
>
> Sorry if that question seems trivial or was already asked before.
>
> -Stéphane L.
>
--
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/0fb97f65-5446-478a-9665-075f82789aa0n%40googlegroups.com.