I came up with a method that only shows the outermost box of the table, but what I wanted was to show an automatically sorted numeric sequence number in each cell
The output shows two tables, the first is your manually created table and the second is a macro-generated table.
It takes space-separated strings as an input which are converted to a list with the enlist operator. This is the input for the ListWidget . The output of the ListWidget is numbered with the counter parameter and the current value is available within the index variable.
Each line of the table is generated by line <td><<index>>. <<currentTiddler>></td>.
If you rearrange the input string “python java julia” - e.g. “java python julia” the numbers are still from 1 to 3, but the text has changed.
Thank you very much, I have a very good wiki technology god, to apply this code to the Global, other than adding the tag ‘$:/tags/Global’ is there any other way, maybe it is the only way
You are right - as far as I know it is the only way to made it available everywhere.
Pasting it into every tiddler you need this macro would be no real fun
The import method can be used when it really is not global in any way, that is you only need it in a very specific place.
There are other deprecated tags as well, but it is best to use the above, but its good to know the others because they are still in use in existing plugins etc…
@XYZ - here is an extended solution, just in case that you need to list a programming language with spaces in it’s name. I don’t know which programming language contains really spaces in it’s name, but just for the case.
It actually is an \import [subfilter{$:/core/config/GlobalImportFilter}]. So it does the same thing in a “global” context. That’s why “variables” tagged $:/tags/Global can be seen everywhere.
As Tony wrote, you only need to use \import in a tiddler, for variables that are not tagged for global use.
Thanks, @pmario for sharing more technical details.
This is a feature to share it with specific tiddlers instead of the whole wiki.
In other words: it is better to water in spots than to water everything with a large watering can.
Yes. The advantage is, that you exactly “know what you get”.
With the global import, that last “variable” defined with the “same name” will be the one, that you get.
As the import-mechanism was created (in the early days), there was “local” import only. But it is inconvenient, if you manually need to keep track where your “stuff” is Especially since the tiddler naming conventions where still unstable.
So it was pretty clear, that we need a “global” import, even if it means that there is a higher chance of “naming collisions”. There are always “pros” and “cons”.
ok, that makes sense to me.
Thanks also for the excursion into the beginnings of Tiddlywiki, for me as a late starter it’s always very interesting.
Off-topic:
By the way, I still can’t understand why I didn’t discover it earlier, because it’s extremely useful for me and I discover new applications every day. I’m really grateful for the software, it’s really great and exactly what I needed
I can understand that and I consider the import pragma to be a successful way of skilfully avoiding possible conflicts in the naming.
@RetRoland interestingly the Opposite is also true; Some times we want conflict
We can use the import pragma to import macros or procedures in a specific location that have the same names as existing global macros, in effect locally replacing the global macro. For example you may want to override a macro to include a new feature, but rather than reinvent the wheel, clone, and modify an existing macro/procedure, importing the new version only where needed.
You’re right, I wasn’t thinking about that when I wrote those lines.
My usual workflow was to copy the old macro (located n a global macro tiddler) and add a consecutive number (e.g. funkymacro2) - the new features were then tested accordingly with <<funkymacro2>>.
As soon as it worked, I deleted the old funkymacro and renamed the funkymacro2 back to funkymacro.
Not nifty at all, but it worked to preserve the working (old) macro while working on a newer version.
[Edited] added backticks to macros for better readabilty, too - was a bit in a hurry when writing the first message