Is there any related usage of macro variable on documentation?

\procedure icons()
gif svg
\end

\procedure gif()
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16"><path fill="currentColor" d="M5.052 6.706c.481-.05.853.037.986.103a.5.5 0 1 0 .447-.894c-.351-.176-.928-.267-1.537-.203c-.96.1-1.948.934-1.948 2.297c0 1.385 1.054 2.3 2.3 2.3c.58 0 1.1-.272 1.397-.553c.262-.248.303-.577.303-.783v-.964a.5.5 0 0 0-.5-.5h-.807a.5.5 0 1 0 0 1H6v.464a.427.427 0 0 1-.006.071a1.126 1.126 0 0 1-.694.265c-.731 0-1.3-.505-1.3-1.3c0-.818.567-1.252 1.052-1.303M9 6.21a.5.5 0 0 0-1 0v3.6a.5.5 0 1 0 1 0zm1.5-.5a.5.5 0 0 0-.5.5v3.6a.5.5 0 0 0 1 0V8.506l1.003-.006a.5.5 0 0 0-.006-1L11 7.506v-.797h1.5a.5.5 0 0 0 0-1zM3.5 2A2.5 2.5 0 0 0 1 4.5v7A2.5 2.5 0 0 0 3.5 14h9a2.5 2.5 0 0 0 2.5-2.5v-7A2.5 2.5 0 0 0 12.5 2zM2 4.5A1.5 1.5 0 0 1 3.5 3h9A1.5 1.5 0 0 1 14 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 11.5z"/></svg>
\end

\procedure svg()
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 256 256"><g fill="none"><rect width="256" height="256" fill="#242938" rx="60"/><path fill="#000" d="M17 120h220.641v73.109c0 17.18-14.036 30.336-32.356 30.336H49.355C31.032 223.445 17 210.289 17 193.109z"/><path fill="#ffb13b" stroke="#000" stroke-width="28.7" d="M61.633 108.908c-6.824-6.402-17.89-6.402-24.715 0c-6.824 6.399-6.824 16.774 0 23.176c6.824 6.398 17.89 6.398 24.715 0h131.215c6.828 6.398 17.89 6.398 24.718 0c6.825-6.402 6.825-16.777 0-23.176c-6.828-6.402-17.89-6.402-24.718 0z"/><path fill="#ffb13b" stroke="#000" stroke-width="28.73" d="M89.59 68.803c0-9.055-7.824-16.39-17.477-16.39c-9.656 0-17.48 7.335-17.48 16.39c0 9.05 7.824 16.386 17.48 16.386l92.782 87c0 9.051 7.824 16.387 17.476 16.387s17.477-7.336 17.477-16.387c0-9.05-7.825-16.386-17.477-16.386z"/><path fill="#ffb13b" stroke="#000" stroke-width="28.7" d="M139.602 58.979c6.824-6.403 6.824-16.778 0-23.18c-6.829-6.399-17.895-6.399-24.719 0c-6.824 6.402-6.824 16.777 0 23.18v123.035c-6.824 6.398-6.824 16.777 0 23.175c6.824 6.403 17.89 6.403 24.719 0c6.824-6.398 6.824-16.777 0-23.175z"/><path fill="#ffb13b" stroke="#000" stroke-width="28.73" d="M182.371 85.19c9.652 0 17.477-7.336 17.477-16.387c0-9.055-7.825-16.39-17.477-16.39c-9.652 0-17.476 7.335-17.476 16.39l-92.782 87c-9.656 0-17.48 7.336-17.48 16.386c0 9.051 7.824 16.387 17.48 16.387c9.653 0 17.477-7.336 17.477-16.387z"/><path fill="#ffb13b" d="M61.633 108.908c-6.824-6.402-17.89-6.402-24.715 0c-6.824 6.399-6.824 16.774 0 23.176c6.824 6.398 17.89 6.398 24.715 0h131.215c6.828 6.398 17.89 6.398 24.718 0c6.825-6.402 6.825-16.777 0-23.176c-6.828-6.402-17.89-6.402-24.718 0z"/><path fill="#ffb13b" d="M89.59 68.803c0-9.055-7.824-16.39-17.477-16.39c-9.656 0-17.48 7.335-17.48 16.39c0 9.05 7.824 16.386 17.48 16.386l92.782 87c0 9.051 7.824 16.387 17.476 16.387s17.477-7.336 17.477-16.387c0-9.05-7.825-16.386-17.477-16.386z"/><path fill="#ffb13b" d="M139.602 58.979c6.824-6.403 6.824-16.778 0-23.18c-6.829-6.399-17.895-6.399-24.719 0c-6.824 6.402-6.824 16.777 0 23.18v123.035c-6.824 6.398-6.824 16.777 0 23.175c6.824 6.403 17.89 6.403 24.719 0c6.824-6.398 6.824-16.777 0-23.175z"/><path fill="#ffb13b" d="M182.371 85.19c9.652 0 17.477-7.337 17.477-16.387c0-9.055-7.825-16.39-17.477-16.39c-9.652 0-17.476 7.335-17.476 16.39l-92.782 87c-9.656 0-17.48 7.336-17.48 16.386c0 9.051 7.824 16.387 17.48 16.387c9.653 0 17.477-7.336 17.477-16.387z"/><path fill="#000" fill-opacity="0.9" d="M17 121h220.641v73.109c0 17.18-14.036 30.336-32.356 30.336H49.355C31.032 224.445 17 211.289 17 194.109z"/><path fill="#fff" d="M50.027 172.135c-5.175-4.852-8.379-11.551-8.379-18.949c0-14.805 12.809-26.809 28.59-26.809c15.79 0 28.594 12.004 28.594 26.809H82.086c0-6.133-5.309-11.102-11.848-11.102c-6.539 0-11.84 4.969-11.84 11.102c0 3.062 1.329 5.839 3.461 7.839h.008c2.145 2.02 3.93 2.602 8.371 3.266c7.899.77 15.043 3 20.219 7.852c5.176 4.855 8.375 11.554 8.375 18.953c0 14.804-12.805 26.812-28.594 26.812c-15.781 0-28.59-12.008-28.59-26.812h16.75c0 6.133 5.301 11.109 11.84 11.109c6.54 0 11.848-4.976 11.848-11.109c0-3.063-1.324-5.832-3.461-7.84h-.008c-2.144-2.012-5.223-2.703-8.379-3.258v-.004c-7.656-1.101-15.035-3.004-20.21-7.859m105.988-45.758l-20.227 91.531h-16.746l-20.211-91.531h16.75l11.852 53.609l11.832-53.609zm28.597 37.914h28.586v26.805h.008c0 14.808-12.805 26.816-28.594 26.816c-15.793 0-28.59-12.008-28.59-26.816v-37.91h-.007c0-14.805 12.804-26.805 28.597-26.805c15.782 0 28.586 12 28.586 26.805h-16.746c0-6.125-5.308-11.102-11.84-11.102c-6.543 0-11.843 4.977-11.843 11.102v37.91c0 6.133 5.3 11.105 11.843 11.105c6.532 0 11.832-4.972 11.84-11.097v-11.102h-11.84z"/></g></svg>
\end

.cm-completionIcon-cm-gif:after {
  margin: 0 0.05em 0 0.1em;
  vertical-align: sub;
  content: url(<$macrocall $name="makedatauri" text=<<gif>> type="image/svg+xml" />);
}


.cm-completionIcon-cm-svg:after {
  margin: 0 0.05em 0 0.1em;
  vertical-align: sub;
  content: url(<$macrocall $name="makedatauri" text=<<svg>> type="image/svg+xml" />);
}


<!-- use enlist -->
<$list filter="[enlist<icons>]" variable="icon">
.cm-completionIcon-cm-<<icon>>:after {
  margin: 0 0.05em 0 0.1em;
  vertical-align: sub;
  content: url(<$macrocall $name="makedatauri" text=$(icon)$ type="image/svg+xml" />);
}
</$list>

Is there any related usage of macro variable position symbols? (Maybe my description is not accurate enough)

I want to implement a loop, but the variables of this loop need to be the corresponding macro variables

I tried many keywords to find related usage of macro variables. I remember seeing a related summary before, but now I can’t find it. There are so many tiddlers about it that I can’t find anything useful.

Is this what you mean?

<$list filter="[enlist<icons>]" variable="icon">
.cm-completionIcon-cm-<<icon>>:after {
  margin: 0 0.05em 0 0.1em;
  vertical-align: sub;
  content: url(<$transclude $variable="makedatauri" text=<<icon>> type="image/svg+xml" />);
}
</$list>

The icon here should be the name of a macro, like <<svg>> or <<gif>>. I don’t know how to deal with this problem. Eventually I found another way to achieve a similar effect.

\define icons(icons)
<$list filter="[enlist<__icons__>]" variable="icon">
.cm-completionIcon-cm-<<icon>>:after {
  margin: 0 0.05em 0 0.1em;
  vertical-align: sub;
  content: url(<$transclude $variable="makedatauri" text={{{ [[$:/plugins/oeyoews/tiddlywiki-codemirror-6/icon-dict]getindex<icon>] }}} type="image/svg+xml" />);
}
</$list>
\end

<<icons "svg gif">>

But it’s strange. If you replace define here with procedure, macor will not work.

Is there a way to automatically obtain these keys from $:/plugins/oeyoews/tiddlywiki-codemirror-6/icon-dict tiddler?

This?

<$list filter="[enlist<icons>]" variable="icon">
.cm-completionIcon-cm-<<icon>>:after {
  margin: 0 0.05em 0 0.1em;
  vertical-align: sub;
  content: url(<$transclude $variable="makedatauri" text={{{ [<icon>getvariable[]] }}} type="image/svg+xml" />);
}
</$list>
1 Like

getvariable perfectly solves this problem

1 Like