Emulating slices/sections with macros

84 views
Skip to first unread message

Mark S.

unread,
May 5, 2020, 12:45:19 PM5/5/20
to TiddlyWiki
Not too serious of a proposal. Just a random thought about slices/sections. Just realized they could be emulated to a degree with macros.

\define mas_01()
* Sections were really useful
** I can't help but miss them
Their functionality can be imitated using macros!
\end

\define comment() THE FOLLOWING ASSUMES YOU HAVE TIDDLER "Find me 2"

\define mas_02()
{{Find me 2}} is another tiddler. Which means you can use real transclusions as well.
\end

\define mas_03()
You can also '
transclude' other sections using macros:
<<mas_02>>
\end

<$list filter="[variables[]prefix[mas]sort[]]" variable="macro">
<$button set={{{[[$:/state/]addsuffix<macro>]}}} setTo="show">Show <<macro>></$button>
<$button set={{{[[$:/state/]addsuffix<macro>]}}} setTo="hide">Hide <<macro>></$button><br/>
<$reveal type="match" state={{{[[$:/state/]addsuffix<macro>]}}} text="show">

<$macrocall $name=<<macro>>/>

</$reveal>

</$list>


Mat

unread,
May 5, 2020, 5:21:13 PM5/5/20
to TiddlyWiki
Thanks for sharing Mark. I share your feelings about slices. Your creation is interesting but doesn't it miss out on the main point with slices - i.e that you can access the slice from another tiddler?

<:-)

Mark S.

unread,
May 5, 2020, 5:48:01 PM5/5/20
to TiddlyWiki
If you have the tiddler tagged $:/tags/Macro, you can access any "slice" from any tiddler.

TonyM

unread,
May 5, 2020, 8:15:00 PM5/5/20
to TiddlyWiki
Mark,

Good ideas, as is often the case you and Mat inspire me. I do not have time now to demonstrate the ideas you have spawned, but here is a few quick points, and without the detail may provide inspiration to you both;
  • What of a customised excise tool, that cuts selected text, asks for a title, and generates a macro in a separate tiddler, leaving behind the macro in the source?
    • A Conditional component that allows one to turn on and off a link, show hide etc of the "excised tiddler macro" ot snipit-macro would be nice
  • Rather than define the macro in the excised tiddler (a macro-snipit), Perhaps this smarter that the first suggestion, tag the excised tiddler with $:/tags/macrosource, and have a process that converts all snipits into a macro `<<tiddlername>>`, this would allow reusable code, and to add remove buttons to all snipit-macros. The snipit macros could also accept parameters such as display, click to open etc...
Regards
Tony
Reply all
Reply to author
Forward
0 new messages