On solution to my problem is to tag my sample macro tiddler as a system
macro.
But this has the problems that its macros are now public and their names
must now be made unique.
I can do that by calling my macro as demo-for-this-and-that instead of just
macros (including helpers macros, which would clutter my main macro code).
and at the beginning of my how to tiddler I would add:
\define demo(foo:bar etc) <<demo-for-this-and-that foo etc>>
not very nice neither very practical but the best I could do so far.
--
Jean-Pierre
Le jeudi 8 avril 2021 à 12:57:40 UTC+2, Jean-Pierre Rivière a écrit :
> Macro should be at the beginning of a tiddler before anything else.
>
> IMHO there could be an exception: including macros.
>
> Here is my use case: I'm writing a tutorial/how-to about difficulties in
> TW programming. I illustrate my points with sample macros. I want to show
> the code within my articles and expose the output of invoicing the macros
> there as well.
>
> I don't want to copy-paste the code. This is not pedagogic and prone to
> errors.
>
> I know how to do this for code which does not include macros.
>
> For code with macro definitions, my how-to tiddler would begin by
>
> {{my-sample-macros]]
>
> which would be replaced by
>
> \define foo() bar
>
> which would be OK as far as macro definitions is concerned IF my exception
> was an implemented feature.
>
> Now' There could be a way around if there is a mean to dynamically create
> a new tiddler with the include already done, a tiddler that I would use for
> viewing, keeping the tiddler with the macro-including-start as a source of
> my tiddler. I have not yet explored that way as I am deeply ignorant about
> dynamic creation of tiddlers yet.
>
> --
> Jean-Pierre
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/714d23e4-680c-4c1a-9594-2401c52c58b4n%40googlegroups.com.