Hi Eucaly
The function you've ended up with is very similar to
Widget.getStateQualifier():
/*
Construct a qualifying string based on a hash of concatenating the values
of a given variable in the parent chain
*/
Widget.prototype.getStateQualifier = function(name) {
name = name || "transclusion";
var output = [],
node = this;
while(node && node.parentWidget) {
if($tw.utils.hop(node.parentWidget.variables,name)) {
output.push(node.getVariable(name));
}
node = node.parentWidget;
}
return "{" + $tw.utils.hashString(output.join("")) + "}";
};
https://github.com/Jermolene/TiddlyWiki5/blob/master/core%2Fmodules%2Fwidgets%2Fwidget.js#L197
There's also a JavaScript "qualify" macro. We could extend it so that there
is an additional parameter to specify the variable name to use (which would
default to "transclusion").
Could this meet your needs?
Best wishes
Jeremy
On Wed, Sep 10, 2014 at 9:22 AM, Eucaly J <[email protected]> wrote:
> Dear all:
>
> I found this can be done by some javascript macro.
> So, there's no need for "feature request"
>
> I will post the full macro later
>
> exports.run = function(variable_name) {
> var output = "";
> var p = this;
> var v0 = "";
> while (p)
> {
> var v = p.getVariable(variable_name);
> if ( v && v!=v0)
> {
> output = output + "[[" + v + "]] ";
> v0 = v;
> }
> p = p.parentWidget;
> }
> return output;
> };
>
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>
--
Jeremy Ruston
mailto:[email protected]
--
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.
For more options, visit https://groups.google.com/d/optout.