Hi Folks,

In the following macro I can simply generate fieldname=value pairs for all 
fields in the current tiddler, similar to how one would use the vars 
widget. It is handy because it only list the existing fields, however many 
they are. You do not need explicit set or Var statements.


   - We could use this to pass field names and values say in a new tiddler 
   button, which I have done before.
   - You can also use it to pass variables to a modal


However I do not know how to use this or a similar method to convert these 
to actual variables for use in the current tiddler.

The issue is one needs to use either the set or vars parameter. 

   - The set required as many `</$set>` close statements as fields.
   - The vars needs only an open and close
   - However placing `<<field-value-pairs>>` inside a $vars widget - does 
   not work

\define field-value-pairs()
\whitespace trim
<$list filter="[all[current]fields[]] -[[text]] -[[title]]" variable=
fieldname>
{{{ [<fieldname>addsuffix[-var]] }}}=<$text text={{{ [all[current]get
<fieldname>addprefix["""]addsuffix["""]] }}}/><br>
</$list>
\end
<<field-value-pairs>>

If you look inside $:/core/ui/ViewTemplate you can see how the variable 
storyTiddler is set, it then retains its value within the current story 
Tiddler. Because the loaging of each tiddler is wrapped in the vars 
statement.  I wonder if this is a place to put this? At least for tiddlers 
with a flag/tag/filed on them.

The alternative is define statements which also are not generated 
programmatically. I suppose with a trigger you could generate a tiddler 
full of defines and import that, but you will still need a trigger. We 
could use a trigger on "open tiddler" if one were available via the 
navigator mechanism.

Any Gurus up to this challenge?

*Why?*

Because I have come across a few cases where this would be useful, such as;

   - Creating a tiddler text template in a define where all values can use 
   the same notation eg  $(varname)$
   - Rather than set such variable as needed, have them all available using 
   a single method.
   - Avoid the need to complicate the wikitext with both {{!!fieldname}} 
   and <<fieldname>> references inside and outside filters.

I look forward to an inventive solution (If I do not come up with one first)

Regards
Tony


-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3ecf7410-58a3-4779-a599-00e0c7247fcd%40googlegroups.com.

Reply via email to