On Sunday, July 5, 2020 at 4:43:45 AM UTC-7, Jake wrote:
>
> In the end I decided to stick with this final macro:
> \define vid(id, w:"534px", h:"300px")
> <iframe src={{{ [[$id$]addprefix[https://www.youtube.com/embed/]] }}}
> width="$w$" height="$h$" frameborder="0" allowfullscreen></iframe>
> \end
> and usage like: <<vid "ScjChJDp3mo">>. Don't want to deal with
> youtube.com/youtu.be and https:/http: in the future.
>
Good thinking. While there are many different URLs that can be used to get
to a specific YouTube video page, the all rely on the same unique "video
code".
> Btw, did I get it right that you don't need to specify
> (parameters/variables - whatever they're called) of the macro when calling
> it and if their names are omitted macro just handles them in a specified
> order?
> So I don't need to write: <<vid id:"VIDEOID" w:"640" h:"360">> and I can
> write just <<vid "VIDEOID" "640" "360">>?
>
That is correct. If you omit the names in the macro parameters, then they
are simply matched up, left-to-right, with the macro definition.
The only drawback is that if you want to skip a particular parameter
(allowing it's default to be used), then you need to use a "placeholder" in
the macro call.
For example, using your "vid" macro as above, if you wanted to specify the
height, but not the width, you would need to write this:
<<vid "ScjChJDp3mo" "" "500px">>
in contrast, if you *do* use the parameter names, you don't need a
placeholder:
<<vid id:"ScjChJDp3mo" h:"500px">>
-e
--
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/23c76e27-384f-418b-8564-be58242dbf61o%40googlegroups.com.