Hi Jeremy, Thanks! That's marvelously concise.
On Thursday, February 14, 2019 at 10:01:19 AM UTC, Jeremy Ruston wrote: > > Hi Mark > > The following version works. > > \define concatStateTiddler() > <$set filter="[all[current]get[draft.of]] [all[current]!has[draft.of]] > +[addprefix[$:/state/]]" name="kitty"><$text text=<<kitty>>/></$set> > \end > > \define backup(value) > <$wikify text=<<concatStateTiddler>> name=cst> > <$view tiddler=<<cst>> field="""$value$"""/> > </$wikify> > \end > > > I think that this can be done much more concisely and efficiently. > > At the moment concatStateTiddler is using the "filter" attribute of the > set widget. That means that the result of will be a list of titles, using > double square brackets to quote titles containing spaces. > > I don't fully understand the original problem, but unless you definitely > need to have that quoting, it would be more concise to write this: > > <$text text={{{ [all[current]get[draft.of]] ~[all[current]] > +[addprefix[$:/state/]] }}}/> > > In the backup macro you're using the wikify widget on the result of the > concatStateTiddler macro. Perhaps it's because you want to get the result > of concatStateTiddler into a variable? But that doesn't make sense, because > the substance of concatStateTiddler is to assign a value to a variable and > then return it as text. > > Stepping back, it looks like this should work: > > \define backup(value) > <$view tiddler={{{ [all[current]get[draft.of]] ~[all[current]] > +[addprefix[$:/state/]] }}} field=<<__value__>>/> > \end > > Best wishes > > Jeremy > > > > > > You can't concatenate a <<variable>> inside text like that ... well ... > maybe with a lot of patient application of wikify (which I needed anyways). > Instead, I used the "addprefix" operator to do the concatenation, following > up on a suggestion by Jeremy in an earlier post today. > > Note, all the extra space and line feeds had to be squeezed out of > concatStateTiddler -- if GG puts them back in ... take them out. > > The <$text> widget was used to convert the resulting item (which would > otherwise have been a link because *filter* generates a title list) into > plain text, and <$wikify> was used to make the entire result of > concatStateTiddler into a single variable. > > Hope this was something like what you wanted! > > -- Mark > > > > On Tuesday, February 12, 2019 at 4:58:14 PM UTC-8, admls wrote: >> >> Hi Folks, >> >> I'm trying to populate a stylesheet, but I'm having trouble getting these >> macros to work together. The concatStateTiddler macro is supposed to give >> me the name of a state tiddler tacked composed of a prefix and the name of >> the currentTiddler. The backup macro is supposed to fetch some value from >> the state tiddler if it is present. And if it is not present, it should >> fetch it from a set of backup values. >> >> \define concatStateTiddler() >> <$set filter="[all[current]get[draft.of]] [all[current]!has[draft.of]]"> >> "$:/state/<<currentTiddler>>" >> </$set> >> \end >> >> \define backup(value) >> <$view tiddler=$(concatStateTiddler)$ field="""$value$"""> >> <$view tiddler="$:/config/backup-values" field="""backup-$value$"""> >> </$view> >> </$view> >> \end >> >> I can get it to work if concatStateTiddler looks like this: >> \define concatStateTiddler() >> "$:/state/$(currentTiddler)$" >> \end >> >> But I want the view and edit mode versions of the tiddler to use the same >> state tiddler. Hence the first version of concatStateTiddler. But the first >> version doesn't play nice with the backup macro. Any ideas of what I'm >> doing wrong here? >> >> The only thing I can think is that the set widget is creating a list, >> even if it is a list consisting of only one element (on account of the use >> of [all[current]]). That list format may be playing havoc with the backup >> macro. But I really don't have any idea beyond that. Any help would be >> greatly appreciated. >> >> Best regards, >> >> Adam >> > -- > 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 <javascript:>. > To post to this group, send email to tiddl...@googlegroups.com > <javascript:>. > 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/ab4280b0-84b5-4447-b516-9dc1d6898885%40googlegroups.com > > <https://groups.google.com/d/msgid/tiddlywiki/ab4280b0-84b5-4447-b516-9dc1d6898885%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- 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 post to this group, send email to tiddlywiki@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/80ec3225-a8d7-410f-b037-ba744b598d04%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.