Hi Mat > I'm unsure why you have two separate macro calls in your example. Regardless, > maybe this works: > > > \define image-inner() [img width=80 [$(caption)$|$(tiddler)$]] > > \define image(tiddler) > <$vars caption={{$tiddler$!!caption}} tiddler='$tiddler$' > > <<image-inner>> > </$vars> > \end > > <:-)
This example illustrates some of the pitfalls of using text substitution with macros: * It will fail if the tiddler title contains ]], }} or !! * or if it ends with a single ! * or if it contains a single quote * It will fail if the caption contains a vertical bar | or double closing square brackets ]] An alternative implementation might be: \define image(tiddler) <$tiddler tiddler=<<__tiddler__>>> <$image source={{!!title}} width=80 tooltip={{!!caption}}/> </$tiddler> \end <<image "Motovun Jack.jpg">> There are several points: * using the <$tiddler> widget to reference the image tiddler so that we can use text references to refer to the fields * using the ability to refer to macro parameters as variables by wrapping it with double underscores * using the <$image> widget rather than the shorthand syntax Best wishes Jeremy > On 7 Aug 2018, at 11:39, Mat <matiasg...@gmail.com> wrote: > > > > > > -- > 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 > <mailto:tiddlywiki+unsubscr...@googlegroups.com>. > To post to this group, send email to tiddlywiki@googlegroups.com > <mailto:tiddlywiki@googlegroups.com>. > Visit this group at https://groups.google.com/group/tiddlywiki > <https://groups.google.com/group/tiddlywiki>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/tiddlywiki/7dbce485-1bc9-4db2-bb7f-a6f1a5f54d82%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywiki/7dbce485-1bc9-4db2-bb7f-a6f1a5f54d82%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- 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 post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at https://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/7BC4DB0A-D335-4C0B-BAFE-291D40E02690%40gmail.com. For more options, visit https://groups.google.com/d/optout.