$set name="currentTiddler" value={{$:/language}}>
<$set name="languageTitle" value={{!!name}}>
<$set name="currentTiddler" value="">
We no longer need to mess around with the currentTiddler variable to be able to access to the "name" field of the current language
<$set name="languageTitle" value={{{ [{$:/language}get[name]] }}}>
<$set name="languageTitle" tiddler={{$:/language}} field="name">
<$set name="languageTitle" filter="[{$:/language}get[name]]">
Recently there was a long and interesting discussion on the $set widget which led to me making the funky (at least I think it's funky!) : Set Widget Tester for attribute precedence
That tiddler allows you to see how most every attribute combination available in the $set widget will behave against other attributes.
Today I came across a little change in the $:/core/ui/PageTemplate tiddler made the other day which made me wonder …
...
The above is of course quite elegant and concise.
Just as a matter of interest, I was wondering why this wasn't written as either of the below:
<$set name="languageTitle" tiddler={{$:/language}} field="name">
<$set name="languageTitle" filter="[{$:/language}get[name]]">
All said, I don't know why, but I quite like the ability to accomplish the same result in 4 different ways. Maybe its because the $set widget can be used so effectively for IF THEN ELSE situations once one known the precedence order of its attributes.
Cheers.--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e96c338e-fb4c-4796-8092-b8f6337f52f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
<$set name="languageTitle" value={{{ [{$:/language}get[name]] }}}>
creates this widget tree, which is 1 step away from the html output.
{
"type": "widget",
"children": [
{
"type": "set",
"attributes": {
"name": "languageTitle",
"value": "en-GB"
}
}
]
}
{
"type": "widget",
"children": [
{
"type": "element",
"tag": "p",
"children": [
{
"type": "text",
"text": "$set name=\"currentTiddler\" value="
},
{
"type": "tiddler",
"attributes": {
"tiddler": "$:/language"
},
"children": [
{
"type": "transclude",
"attributes": {
"tiddler": "$:/language"
},
"children": [
{
"type": "link",
"attributes": {
"to": "$:/languages/en-GB"
},
"children": [
{
"type": "text",
"text": "$:/languages/en-GB"
}
]
}
]
}
]
},
{
"type": "text",
"text": ">\n"
},
{
"type": "set",
"attributes": {
"name": "languageTitle",
"value": ""
},
"children": [
{
"type": "text",
"text": "\n"
},
{
"type": "set",
"attributes": {
"name": "currentTiddler",
"value": ""
},
"children": [
{
"type": "text",
"text": "\n"
}
]
}
]
},
{
"type": "text",
"text": "</$set>"
}
]
}
]
}
have fun!
mario
PS: @Jeremy, ... we should change this, it seems to be much cleener!