<$link to="$:/language/Docs/Fields/{{!!title}}">{{!!title}}</$link>\define languageDocsFields() $:/language/Docs/Fields/$(currentTiddler)$
<$link to=<<languageDocsFields>>><$view field="title"/></$link>
\define languageDocsFields() $:/language/Docs/Fields/$(currentTiddler)$
/*\
title: $:/core/modules/filters/join.js
type: application/javascript
module-type: filteroperator
Filter operator that concatenates all tiddlers from the current list, using the operator as the seperator
\*/
(function(){
/*jslint node: true, browser: true */
/*global $tw: false */
"use strict";
/*
Export our filter function
*/
exports.join = function(source,operator,options) {
var result = '';
source(function(tiddler,title) {
result+=operator.operand + title;
});
return [ result.substr(operator.operand.length) ];
};
})();
<$list filter="[[$:]] [[language]] [[Docs]] [[Fields]] [all[current]] +[join[/]]">
<$view field="title"/>
</$list>
<$list filter="[[$:/language/Docs/Fields]] [all[current]] +[join[/]]">
<$view field="title"/>
</$list>
Here is a generic "join" filter:
Here is a generic "join" filter:Did you just write that or did it come from an already brighter place? ^_^
Would it be sufficient to give the above code tiddler a type of application/javascript so as to have it run after restart?
Just wrote it. 5minutes including testing.
Any chance you'd up this and alike codebits to a GitHub repo of yours? Where?
Not at the moment. I simply don't feel like it.
<$set name="field" value="title">
<$list filter="[[$:/language/Docs/Fields]] [[$field$]] +[join[/]]">
$field$: <$view field="title"/>
</$list>
</$set>
Any idea why using the variable as declared in the set widget won't work with the list widget?
Any idea why using the variable as declared in the set widget won't work with the list widget?
Yes. Variables don't work there. You need an additional macrocall. Additionally you forgot the brackets arounf the variablename: $(field)$
It's pretty easy :
$(var)$ for variable substitution inside macro
$var$ for macro parameter
<<var>> for transclude the variable value within normal wikitext or as parameter of widget calls.Does that make sense for you? It took a while to me to sort this in my mind.
I turned your excellent overview into an example wiki...
...also referenced here:Best wishes, Tobias.
--
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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.
I find the table a bit confusing. The underlying situation is much simpler:* Textual substitution for $parameters$ and $(variables)$ only takes place within macro bodies* Transcluding a variable with <<variable>> is a basic wikitext construct that can also be used for widget/html element attributes* Transcluding a tiddler text reference with {{title}} is a basic wikitext construct that can also be used for widget/html element attributes* Filters use [<variable>] for a variable transclusion, and [{title}] for a tiddler transclusion
I turned your excellent overview into an example wiki...You've been very productive recently! I'd like to link to your new TW5 stuff, what's the best base URL to use?
Note that "$macroParameter$" and [[$macroParameter$]] are both really a combination of two bits of syntax: double square brackets and double quotes to quote a tiddler title that might contain spaces, and the $dollar$ notation for substituting a macro parameter.
You've listed {{transclusion}} under "within macros" which might be misleading: there's no special handling for {{transclusion}} processing within macros; the transclusion is just part of the output of the macro and gets wikified at that point.
Similarly, listing <$widget param="$macroParameter$"/> as a way to pass widget parameters; it's again a compound syntax, whereas the other examples in that section are basic variants of the attribute syntax.
If we teach people that <$widget param="$macroParameter$"/> is an out-of-the-box syntax then they risk missing that they can do things like <$widget param="mytiddlertitleprefix-$macroParameter$"/>. The key is to gain an understanding of the two layers involved.
<<variable>>{{transclusion}}<variable>, "<variable>", [[<variable>]]$macrocall<$widget attribute=<<variable>>/><$widget attribute=<<callMacroToComputeValue>>/><$widget attribute={{transclusion}}/><$widget attribute="prefix-<<variable>>"/><$widget attribute=[[prefix-<<variable>>]]/><$widget attribute="prefix-{{transclusion}}"/>$macroParameter$, "$macroParameter$", [[$macroParameter$]]$(variable)$ (references a variable from the context of the calling macro)<$widget attribute="prefix-$macroParameter$"/><$widget attribute=$macroParameter$/> (unsafe when having spaces)$variable$, "$variable$", [[$variable$]]<<macro param="$macroParameter$">> (only inside macro)<<macro <<variable>> >><<macro "<<variable>>" >><<macro param:<<variable>> >><<macro {{transclusion}}>><<macro param:{{transclusion}}>>[$macroParameter$] (only filters within macros)[tag<variable>] (no inner square brackets!)[tag{transclusion}] (only single curly brackets!)[tag[$(variable)$]][tag[$(variable)$]]What's allowed? | in wiki text | filter in widget call | param in widget call | widget body | macro call | macro body | filter in macro call in macro body | param in macro call in macro body | filter in widget call in macro body | param in widget call in macro body |
| $param$ | ||||||||||
| "$param$" | ||||||||||
| <<param>> | ||||||||||
| "<<param>>" | ||||||||||
| <param> | ||||||||||
| [[<param>]] | ||||||||||
| $var$ | ||||||||||
| "$var$" | ||||||||||
| $(var)$ | ||||||||||
| "$(var)$" | ||||||||||
| <<var>> | ||||||||||
| "<<var>>" | ||||||||||
| <var> | ||||||||||
| [[<var>]] |