Some quick tips

   - In filters you can use the trim operator to remove spaces that creep in
   - If defining macros (especially buttons) use \whitespace trim to 
   eliminate unwanted white space
   - As soon as there is a line break in code that aims to concatenate 
   values you can introduce additional spaces. put them on a single line as in 
   my example below

I imagine your messy macro was due to debugging?

This works!
\define multi-line-example()
xx<$set name="var1" value="A">yy<$set name="var2" 
value="B">zz<<var1>><<var2>>zz</$set>yy</$set>xx
\end

Regards
Tones
On Tuesday, 1 June 2021 at 02:13:19 UTC+10 [email protected] wrote:

>
> Hi,
>
> I've been writing a macro that involves a couple of nested <$set ...> 
> widgets and have spent several hours pulling my hair out, because there 
> were leading and trailing spaces surrounding the parsed macro value that I 
> wasn't putting there, and that were breaking what I wanted to do...
>
> I've finally tracked it down to the macro having each of the <$set ...> 
> tags and their respective closing tags on separate lines (simple example 
> below). If I put everything on a single line, the rogue spaces disappear!
>
> This is odd behaviour to me, as I've always been taught (and found) that 
> multi-line HTML/XML is easier to read, and therefore easier to maintain. Is 
> this expected behaviour or a bug?
>
> Thanks,
>
> Stefan
>
>
> \define multi-line-example()
> xx<$set name="var1" value="A">
> yy<$set name="var2" value="B">
> zz<<var1>><<var2>>zz
> </$set>yy
> </$set>xx
> \end
>
> \define single-line-example()
> xx<$set name="var1" value="A">yy<$set name="var2" 
> value="B">zz<<var1>><<var2>>zz</$set>yy</$set>xx
> \end
>
> +++ Tiddler +++
>
> aa<<multi-line-example>>aa
>
> aa<<single-line-example>>aa
>
> +++ Output +++
>
> aaxx yy zzABzz yy xxaa
>
> aaxxyyzzABzzyyxxaa
>
>
>

-- 
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/42e404ab-ab3d-4e70-928b-92e0caf0cea6n%40googlegroups.com.

Reply via email to