However, in the same tiddler where I define !tip, I have defined
!helloBuddy, which I have been able to use successfully. Here my code,
complete with yours (this prove that the tiddler where it i written if
functional, really):
--- BEGINNING ----
\define !tip(tiddler)
<$tiddler tiddler="$tiddler$"><$transclude
tiddler="$:/templates/importantTip"/></$tiddler>
\end

\define !helloBuddy(someone)
This is nice to meet you, $someone$!
<$transclude mode=block tiddler="zorro"/>
\end
--- END ---
use of these functions:
<<!helloBuddy "Joe">>
<<!tip "zorro">>

Anyway, thanks so far for your help. Iv've already made a (little!) part of
my journey into tw5 mastery!


Le jeu. 9 avr. 2020 à 01:16, Jean-Pierre Rivière <
[email protected]> a écrit :

> I cannot make functioning your elaborate mechanism, Joshua. I don't think
> I have made an error of ext. But well, no inclusion is done. No error is
> reported. Is there a way to debug this kind of scripting tw5? It would be
> helpful to know how to do it.
>
> (sorry no screen capture, I've juste sen that it doesn't work yet).
>
> Le mer. 8 avr. 2020 à 07:55, Joshua Fontany <[email protected]> a
> écrit :
>
>> IT actually sounds like we want something closer to a
>> transcluded-template. So, we are going to use 1) a tiddler marked as a
>> global macro and 2) a template tiddler, and 3) a CSS tiddler, 4) a "tip"
>> tiddler.
>>
>> This example mirrors the "documentation macros" from the TiddlyWiki
>> website.
>>
>> In any tiddler tagged `$:/tags/Macro`
>> ```
>> \define !tip(tiddler)
>> <$tiddler tiddler="$tiddler$"><$transclude
>> tiddler="$:/templates/importantTip"/></$tiddler>
>> \end
>> ```
>>
>> Then in `$:/templates/importantTip` we can have:
>> ```
>> <div class="tip-block"><div class="tip-icon">{{$:/core/images/tip}}</div>
>> <$view tiddler=<<currentTiddler>> field="text"/></div>
>>
>> ```
>> And then we have a tiddler tagged wit `$:/tags/Stylesheet`:
>> ```
>> .tip-block { border-left: 2px solid #e1e1e8; margin-left: 3em;
>> padding-left: 0.6em; position: relative; }
>> .tip-icon { position: absolute; left: -3em; top: 0.2em; }
>> .tip-icon .tc-image-tip { fill: #5778d8; }
>> ```
>> Finally in `TiddlerWithTipText` the text field contains:
>> ```
>> This is a very important tip!
>> ```
>>
>> Now that is all setup, we can- in any other tiddler we like - call it
>> like this:
>> ```
>> Content that sets up context for a user tip.
>>
>> <<!tip "tiddlerWithTipText>>
>>
>> ```
>>
>> I have attached a quick screenshot of this in action on TiddlyWiki.com. I
>> hope this helps demonstrate how combining just a few basic tiddlywiki
>> concepts can be very powerful.
>>
>> Some thing to note. In the macro, the `$variable$` text substitution will
>> only work within the macro, which is why it is not used in the transcluded
>> template. Instead, we set the <$tiddler> widget in the macro, and then in
>> the template we call the <<currentTiddler>> variable (set by the $tiddler
>> macro). If we want to extend this to be more flexible, we could allow the
>> <<!tip>> macro to take another parameter like so:
>>
>> ```
>> \define !tip(tiddler, template:"$:/templates/importantTip")
>> <$tiddler tiddler="$tiddler$"><$transclude
>> tiddler="$template$"/></$tiddler>
>> \end
>> ```
>>
>> Now we can call it with one parameter, and it will use the default
>> template. If we call it with 2 parameters it will use the value of the 2nd
>> a the  template tiddler to transclude.
>>
>>
>> Best,
>>
>> Joshua Fontany
>>
>> [image: ComplexTranscludeMacroDemo.png]
>>
>>
>>
>> On Tuesday, April 7, 2020 at 3:39:41 PM UTC-7, Jean-Pierre Rivière wrote:
>>>
>>> Hi!
>>>
>>> I'm using tiddlywiki v5.1.21 to produce some rulsets. I'd like to have
>>> some special kind of tiddlers for tips and warning.
>>>
>>> Basically, I was thingking of a simple transclusion like:
>>>
>>> {{look at that tip}}
>>>
>>> which doe the trick, but you cannot see it's a tip. So I thought doing
>>> that:
>>>
>>> <aside>
>>> {{look at that tip}}
>>> </aside>
>>>
>>> (with a few css in the bargain). BUT the tranclusion in that xase is
>>> incomplete: the transcluded tiddler has not any paragraph (code <p>...</p>)
>>> even though is was coded so as to to have several ones. Which means it is
>>> useless. Even a simple <div> has the same failure.
>>>
>>> I've tried looking for transclusion in this group. I notably saw tw5
>>> magick trick for "full-enhanced"
>>> http://tw5magick.tiddlyspot.com/#Another%20TOC%20example but then I got
>>> an error: 'Recursive transclusion error in transclude widget'. My code is
>>> below:
>>>
>>> ! <span title="Edit section"><$button message="tw-edit-tiddler"
>>> param={{!!title}} class="btn-invisible"><$view
>>> field="title"/></$button></span>
>>> <$transclude/>
>>>
>>> (a direct paste of the original, in a tiddler named "full-enhanced").
>>>
>>> I also poke at
>>> https://groups.google.com/forum/#!topic/TiddlyWiki/rsoiC7DdnsE which
>>> has some nice TOC tricks but far above my level of understanding.
>>>
>>>
>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/tiddlywiki/pzdXfx9cMwQ/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/93832ae0-dae4-4198-b2bc-1b14348c92fe%40googlegroups.com
>> <https://groups.google.com/d/msgid/tiddlywiki/93832ae0-dae4-4198-b2bc-1b14348c92fe%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Jean-Pierre
>


-- 
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/CADGOhxP%3D-2xdKaYtPmP1p_1gJy%2BEQK7dkRGb1sL5j__TFBftAQ%40mail.gmail.com.

Reply via email to