On Sunday, September 13, 2015 at 8:24:08 AM UTC-7, Hegart Dmishiv wrote:
>
> On Monday, September 14, 2015 at 3:09:47 AM UTC+12, PMario wrote:
>>
>> TW5 is not 100% compatible with TWc. It is a rewrite from scratch.
>> see: http://tiddlywiki.com/#Macros:Macros%20Transclusion
>> -m
>>
>
> Thanks for the reply, but, um, does that mean I'll have to learn how to
> write JavaScript in order to do simple transclusion with parameters in
> TW5.x? What do widgets have to do with any of it? Sorry, what seemed to be
> a standard and simple technique is ending up in the "too hard basket". Why
> would a core functionality in a previous version no longer be available in
> the update? If we have to learn to write JavaScript to use it, then is it
> really even a wiki still?
>
> I don't mean to be harsh, but I'm really disappointed that I've spent so
> much time on this so far, only to find that the most basic of functionality
> that I'll need from it is not readily available to me. I can do wikitext. I
> can't do JavaScript.
>
In TWClassic, the core <<tiddler>> macro was used to perform transclusion.
It was later extended to add support for "with: param param param".
In modern TW, transclusion is done with native syntax, e.g.
{{NameOfTiddler}}. This renders the content of the specified tiddler. Any
TextReferences (e.g., {{!!somefield}}) in the content are replaced with the
corresponding field values from the tiddler.
TW's transclusion syntax also lets you specify a second tiddler name, like
this: {{TiddlerA||TiddlerB}}. This allows you to use TiddlerB as a
"template" to render the values stored in TiddlerA. If TiddlerA has
*fields* named "foo" and "bar", with values of "mumble" and "frotz"
respectively, and TiddlerB contains:
This is from {{!!title}}
The value of foo = {{!!foo}}
The value of bar = {{!!bar}}
then the output of {{TiddlerA|TiddlerB}} would be:
This is from TiddlerA
The value of foo = mumble
The value of bar = frotz
Note that if the {{TiddlerA|TiddlerB}} syntax is invoked directly from
TiddlerA, you can omit the first tiddler name and just write {{||TiddlerB}}
to transclude the content of TiddlerB with values from TiddlerA (i.e., the
"current tiddler" is applied by default)
You can also use *variables* to "pass" named parameters for the
transclusion, like this:
<$vars foo="mumble" bar="frotz">
{{||TiddlerB}}
</$vars>
where TiddlerB contains something like:
This is from {{!!title}}
The value of foo = <<foo>>
The value of bar = <<bar>>
Thus, in TWC you write:
<<tiddler NameOfTiddler with: arg1 arg2 arg3 ...>>
while in modern TW you write:
<$vars var1="arg1" var2="arg2" var3="arg3" ...>
{{NameOfTiddler}}
</$vars>
Note that the *names* of the variables are arbitrary... you can use any
names you like, not just $1 through $9, and you can have as many variables
as you need (not just 9 total).
If you really want to use the old TWC syntax, here a TW macro that (mostly)
recreates the old syntax:
\define tiddler(title,arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9)
<$set name="$1" value="$arg1$">
<$set name="$2" value="$arg2$">
<$set name="$3" value="$arg3$">
<$set name="$4" value="$arg4$">
<$set name="$5" value="$arg5$">
<$set name="$6" value="$arg6$">
<$set name="$7" value="$arg7$">
<$set name="$8" value="$arg8$">
<$set name="$9" value="$arg9$">
{{||$title$}}
</$set>
</$set>
</$set>
</$set>
</$set>
</$set>
</$set>
</$set>
</$set>
\end
Note the use of separate <$set> widgets rather than a single <$vars>
widget. This is because <$vars> does not permit variables to start with
"$" and we are trying to be as close to the old TWClassic usage as
possible. One difference: to substitute param values into the "content
tiddler", you have to write <<$1>> instead of just $1.
Hopefully, this should be enough for you to achieve your goals. Let me
know if you get stuck....
enjoy,
-e
Eric Shulman
ELS Design Studios
TiddlyTools - "Small Tools for Big Ideas!"
InsideTiddlyWiki: The Missing Manuals
YOUR DONATIONS ARE VERY IMPORTANT!
HELP ME TO HELP YOU - MAKE A CONTRIBUTION TO MY "TIP JAR"...
http://TiddlyTools.github.com/fundraising.html#MakeADonation
Professional TiddlyWiki Consulting Services...
Analysis, Design, and Custom Solutions:
http://www.TiddlyTools.com/#Contact
--
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 post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/a29af601-bbc0-4883-a860-561682307fe2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.