Struggling with macro parameters handling

Hi,
I am trying to parametrize the number of columns displayed in my list of tiddlers tagged with the current one but I can’t figure how to make work the following code:

\define T-list(cols:2)
<div style="column-count:<<__cols__>>;">
    <<list-links [all[current]tagging[]!has[draft.of]]>>
</div>
\end

the <<cols>> is not replaced inside the “”…

Replace this with

style.column-count=<<__cols__>>

1 Like

Thx a lot for the quick answer. You saved my day!

I discovered that it would have worked far better with procedure, like

\procedure T-list2(cols:1)
<div style=```column-count:$(cols)$;```>
    <<list-links [all[current]tagging[]!has[draft.of]]>>
</div>
\end


\procedure T-list(cols:1)
<div style.column-count=<<cols>>>
    <<list-links [all[current]tagging[]!has[draft.of]]>>
</div>
\end

Bottom line: I will stop to use macros, it’s deprecated

At this time, that is not true.

https://tiddlywiki.com/#Pragma%3A%20\define

https://tiddlywiki.com/#Macro%20Definitions

Try this at TiddlyWiki.com:

\define T-list(cols:2)
<div style="column-count:$cols$;">
    <<list-links [tag[HelloThere]]>>
</div>
\end

<<T-list>>

Should be. Transclusion is a amazing feature, but TW syntax is a mess. I can’t write a single snippet without falling in a pittfall, and it’s hard to figure out what I have done wrong. I am for a full rewrite of TW to really unleash the full power of the concept.

I instantly and fully embraced TiddlyWiki because it is an intertwingularity-taming beast.

And I am firmly sticking with TW5.2.3 because I can harness the full power of transclusion without distractions. (I only upgrade something when it hurts too much not to.) Most folk, they find the newest versions of TiddlyWiki work even better.

To me, nothing comes close to handling TW’s transclusion capabilities. Whatever pitfalls you are falling into, don’t be shy: mention them one at a time, and maybe we can all help you out.

I’ve embraced TiddlyWiki because it allows me to unleash the full power of transclusion, so I’m a little bit confused about your challenges. You’ll have to describe these challenges, one at a time (because TalkTiddlyWiki works best with short and focused posts.)

  1. Thanks for the support, the community is very helpful.
  2. I am not shy, but after 18 months of regular use, I should be able to code a snippet without help.
  3. And each time, I really mean each time, something goes wrong and it breaks the flow. It happened again this morning.
  4. The core problem is I don’t master the full cinematic of transclusion and I don’t have skills and tools to easily debug. With python programming, things are so much simple: indentation, colors, logs, completion, high level syntax, and so on.
  5. Documentation: I am currently learning to work with FastAPI, and there are great examples with detailed annotations to explain line by line what it does, explain all concepts involved; the learning curve is so smooth; with TW, it doesn’t click for me.
  6. I could probably dig deeper to master TW and maybe I will because it’s currently very frustrating, but I don’t know how much I need to invest to reach that goal.

Bottom line: TW has an amazing flow when I add content, but a terrible one when I try to add features.

Thanks

However you approach creating in TiddlyWiki, do avoid thinking like a Python/javascript/C/C++/C#/etc. programmer.

Toss all of that out.

If you know SQL (in particular the relational algebra), that can be useful.

Regardless, make sure you think as TiddlyWiki is. (I often think of this analogy: if you have a tomato seed, give it what a tomato seed needs; don’t try to grow a potato from that seed.)

Without knowing where your struggles are, I am left with: there is no reason for you to struggle with anything other than your way of thinking being a serious hurdle. I’m thinking there is something fundamental/crucial that you’ve misunderstood or missed.

Maybe take a look at some TiddlyWiki instances out there. For example, here are two of mine that are kind of different: