[tw5] Re: How do I use a URL in a macro?

2021-09-20 Thread thor...@gmail.com
Thank you, your explanation it makes it very clear what's going on. Whoops 
:D!

> Either way, it's going to be "more typing" (but only a little).  Still, 
its less typing than the full `<$macrocall ...>` widget syntax.

In this case, I will be using the `<$macrocall ...>` syntax because I want 
to create a template tiddler using `tm-new-tiddler`. This template contains 
wikitext which field-transcludes a URL field. However, if I want to create 
a generic macro for links where I might want to specify the URL scheme, I 
know to watch out for my colons this time :D!


On Monday, September 20, 2021 at 8:35:52 AM UTC-4 Eric Shulman wrote:

> On Monday, September 20, 2021 at 12:35:18 AM UTC-7 thor...@gmail.com 
> wrote:
>
>> I can make the first method work by putting the URL in quotes, but I 
>> would like to avoid that in general because it's more typing :): 
>> `>`. Why are the quotes required? I 
>> thought macro expansion substituted text without treating the macro inputs 
>> as WikiText?
>>
>
> The `<>` syntax, in addition to handling 
> *unnamed* parameters, also recognizes *named* parameters, using 
> `name:value`.
> Thus, a value like `http://foo.org` is parsed as a parameter named 
> "http", with a value of "//foo.org".  By enclosing it in quotes, it 
> avoids the named parameter parsing and passes it into the macro as a single 
> parameter value
>
> So... you can use the quotes to bypass the parameter name parsing: 
> `>`
> or, you can add a parameter *name*, like this:  `< http://foo.org bar>>`.
>
> Either way, it's going to be "more typing" (but only a little).  Still, 
> its less typing than the full `<$macrocall ...>` widget syntax.
>
> -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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e26ed45a-4043-4fb1-8f15-36fb06780been%40googlegroups.com.


[tw5] Re: How do I use a URL in a macro?

2021-09-20 Thread Eric Shulman
On Monday, September 20, 2021 at 12:35:18 AM UTC-7 thor...@gmail.com wrote:

> I can make the first method work by putting the URL in quotes, but I would 
> like to avoid that in general because it's more typing :): `< http://foo.org"; bar>>`. Why are the quotes required? I thought macro 
> expansion substituted text without treating the macro inputs as WikiText?
>

The `<>` syntax, in addition to handling 
*unnamed* parameters, also recognizes *named* parameters, using 
`name:value`.
Thus, a value like `http://foo.org` is parsed as a parameter named "http", 
with a value of "//foo.org".  By enclosing it in quotes, it avoids the 
named parameter parsing and passes it into the macro as a single parameter 
value

So... you can use the quotes to bypass the parameter name parsing: 
`>`
or, you can add a parameter *name*, like this:  `>`.

Either way, it's going to be "more typing" (but only a little).  Still, its 
less typing than the full `<$macrocall ...>` widget syntax.

-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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/961a4043-498c-47ac-a2d2-1bb5eef6ab85n%40googlegroups.com.