Discussion:
[tw] How to macro > var > macro ??
(too old to reply)
Rustem
2017-07-25 01:57:39 UTC
Permalink
Raw Message
I have these macros defined

\define colorize() color:$(_c)$

\define cn()
<span style=<<colorize>>>
some text
</span>
\end


It works if I specify the color directly

<$vars _c=red><<cn>></$vars>

But how do I specify the color using a macro? This doesn't work:

<$vars _c=<<color tiddler-background>>><<cn>></$vars>

Is it possible?

Thanks.

--R
--
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+***@googlegroups.com.
To post to this group, send email to ***@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/27582014-5db4-4705-861b-189fe27ecdda%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Mat
2017-07-25 03:02:33 UTC
Permalink
Raw Message
Try with the setwidget, or perhaps wikifywidget instead. The varswidget is
not as powerful and I don't think it can handle macrocalls as arguments.
Not sure.

<:-)
--
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+***@googlegroups.com.
To post to this group, send email to ***@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/a6907bd2-74fd-4298-8c41-6c6a0ede3544%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rustem
2017-07-25 06:48:50 UTC
Permalink
Raw Message
Tried with set widget, same, didn't work.
Post by Mat
Try with the setwidget, or perhaps wikifywidget instead. The varswidget is
not as powerful and I don't think it can handle macrocalls as arguments.
Not sure.
<:-)
--
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+***@googlegroups.com.
To post to this group, send email to ***@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/38cca27a-3980-4f34-b1c8-bb09c34c753f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Danielo Rodríguez
2017-07-25 07:12:16 UTC
Permalink
Raw Message
Try enclosing the macro call on quotes <$set value="<<macro>>">
--
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+***@googlegroups.com.
To post to this group, send email to ***@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/85b2e5b9-4874-45a6-af6c-aa3db6ce3ddd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Jeremy Ruston
2017-07-25 08:19:45 UTC
Permalink
Raw Message
Hi Rustem,

Try this:

\define colorize() color:$(_c)$;

\define cn()
<span style=<<colorize>>>
some text
</span>
\end

Specifying a color directly:

<$vars _c=red><<cn>></$vars>

Specifying a color using a macro:

<$wikify name="_c" text="<<color muted-foreground>>">
<<cn>>
</$wikify>

Best wishes

Jeremy.
Post by Danielo Rodríguez
Try enclosing the macro call on quotes <$set value="<<macro>>">
--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
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/85b2e5b9-4874-45a6-af6c-aa3db6ce3ddd%40googlegroups.com.
For more options, visit 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+***@googlegroups.com.
To post to this group, send email to ***@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/B58E53CD-719A-44A8-8B7C-4493E0E60AEF%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Eric Shulman
2017-07-25 08:20:51 UTC
Permalink
Raw Message
Post by Rustem
I have these macros defined
...
Post by Rustem
It works if I specify the color directly
<$vars _c=red><<cn>></$vars>
<$vars _c=<<color tiddler-background>>><<cn>></$vars>
The problem with using the <<color>> macro as a parameter value in the
<$vars> widget is that the macro doesn't return a color value directly.
Instead, it returns transclusion widgets that, if subsequently rendered,
results in a color value. Here's the core definitions (from
$:/core/macros/CSS):

\define colour(name)
<$transclude tiddler={{$:/palette}} index="$name$"><$transclude tiddler="$:/
palettes/Vanilla" index="$name$"/></$transclude>
\end

\define color(name)
<<colour $name$>>
\end

To retrieve the actual color *value*, you can use the <$wikify> widget,
which "captures" the rendered output from the macro and stores that in a
variable, like this:

<$wikify name="_c" text=<<colour tiddler-background>>><<cn>></$wikify>

Note: in this example, "tiddler-background" produces "invisible" text,
since the foreground text color is the same as the background tiddler
color. I assume that was your intention.

Let me know how it goes.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals
--
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+***@googlegroups.com.
To post to this group, send email to ***@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/d542d1c4-762a-4c3c-a23f-1919d86a0a33%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Rustem
2017-07-25 09:38:40 UTC
Permalink
Raw Message
It works with <$wikify> widget. Thanks everyone!
Post by Eric Shulman
Post by Rustem
I have these macros defined
...
Post by Rustem
It works if I specify the color directly
<$vars _c=red><<cn>></$vars>
<$vars _c=<<color tiddler-background>>><<cn>></$vars>
The problem with using the <<color>> macro as a parameter value in the
<$vars> widget is that the macro doesn't return a color value directly.
Instead, it returns transclusion widgets that, if subsequently rendered,
results in a color value. Here's the core definitions (from
\define colour(name)
<$transclude tiddler={{$:/palette}} index="$name$"><$transclude
tiddler="$:/palettes/Vanilla" index="$name$"/></$transclude>
\end
\define color(name)
<<colour $name$>>
\end
To retrieve the actual color *value*, you can use the <$wikify> widget,
which "captures" the rendered output from the macro and stores that in a
<$wikify name="_c" text=<<colour tiddler-background>>><<cn>></$wikify>
Note: in this example, "tiddler-background" produces "invisible" text,
since the foreground text color is the same as the background tiddler
color. I assume that was your intention.
Let me know how it goes.
enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals
--
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+***@googlegroups.com.
To post to this group, send email to ***@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/21fd2f65-f95c-493f-9fe6-b45b428be612%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...