I think you can have your cake and eat it, as long as you use the
tiddlywiki recipe/ingredients.
First lets see if I can explain about order.
If this was my first design (with space between them)
<$transclude field="field1" /> <$transclude field="field2" />
And I decided I wanted;
<$transclude field="field2" /> <$transclude field="field1" />
- I modify the presentation in the above code, I do not need to modify
my data, just its presentation. This may be happening inside a list widget
for example.
- In your case you may need to change both the presentation and the data.
Now, If I understand correctly you want to correctly treat the joining of
"snipits" found in fields correctly, you would be better served building
some standards for your data and tools to do the joining. Since there are
already implied standards for handling those values lets adopt them, then
if you can identify occasions where appending one snippet to the other by
separation with a space, is not working, let us detect and alter that case.
In the original post I think you go down the path of altering the way they
are presented by modifying the data.
*Could you give us some examples where you are finding it hard to join such
snippets?*
I would suggest {{!!foo}}<space>{{!!bar}} for your first example (As did
Mario)
Tones
On Sunday, 15 August 2021 at 22:54:39 UTC+10 Misterel85 wrote:
> 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/16ca2a52-3650-4c35-ade2-571397e83523n%40googlegroups.com.