Re: [tw5]Macro interactions

2019-02-14 Thread admls
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=<>/>
> \end
>
> \define backup(value)
> <$wikify text=<> name=cst>
> <$view tiddler=<> field="""$value$"""/>
> 
> \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 <> 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/<>"
>> 
>> \end
>>
>> \define backup(value)
>> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
>> 
>> 
>> \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 .
> 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/ab4280b0-84b5-4447-b516-9dc1d6898885%40googlegroups.com
>  
> 
> .
> 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 

Re: [tw5]Macro interactions

2019-02-14 Thread Jeremy Ruston
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=<>/>
> \end
> 
> \define backup(value)
> <$wikify text=<> name=cst>
> <$view tiddler=<> field="""$value$"""/>
> 
> \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 <> 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/<>"
>> 
>> \end
>> 
>> \define backup(value)
>> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
>> 
>> 
>> \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+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/ab4280b0-84b5-4447-b516-9dc1d6898885%40googlegroups.com.
> 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/702FAFA6-79D3-438C-98AF-251DCA47474C%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-13 Thread Mal
Adam,

Sorry my response (above) was a bit off the mark.

This has taught me a couple of important lessons:

   1. I need to make sure to read and understand the documentation at 
   tiddlywiki.com - It may not be particularly user-friendly, but it is 
   accurate and concise.
   2. In Tiddlywiki there are usually many ways to achieve the same 
   outcome.  Your use of the set widget is something I have not seen before 
   and, after a bit of thought, I can see that the same could be achieved with 
   other approaches, including the list, reveal or tiddler widgets and 
   probably a few others.

All part of the fun with Tiddlywiki.

Regards,

Mal



-- 
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/612e02c2-5903-49a4-ace5-ccfb27305e96%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-13 Thread admls
Hi S.S.,

I just got the chance to test out your code. I had to massage it just a 
smidge, but it works great! Thank you. I have bashed my head against this 
problem for too long. I'm always amazed at how concise well-written 
tiddlywiki code can be. The solution to my problems is often achieved in 
half the code I thought would be required. 

Thank you everybody!

Best wishes,
Adam

On Wednesday, February 13, 2019 at 1:28:04 PM UTC, S. S. wrote:
>
> Adam, not sure if this is what you want.
>
> In tiddler : NewTiddler
> \define concatStateTiddler(value)
> <$list filter="[all[current]get[draft.of]] [all[current]!has[draft.of]] 
> +[addprefix[$:/state/]]">
> <$view field=backup-$value$/>
> 
> \end
>
> In tiddler: 
> *$:/state/NewTiddler*has field: *backup-1*
> field backup-1 has value : *somevalue*
>
> When *NewTiddler* is being viewed or edited, this macro in its text field 
> *< 1>>*  should give a result of : *somevalue*
>
>
> On Wednesday, February 13, 2019 at 7:58:14 AM UTC+7, 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/<>"
>> 
>> \end
>>
>> \define backup(value)
>> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
>> 
>> 
>> \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+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/e7b4d9b9-acf6-453b-99d7-24f1229c0a53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-13 Thread S. S.
Adam, not sure if this is what you want.

In tiddler : NewTiddler
\define concatStateTiddler(value)
<$list filter="[all[current]get[draft.of]] [all[current]!has[draft.of]] 
+[addprefix[$:/state/]]">
<$view field=backup-$value$/>

\end

In tiddler: 
*$:/state/NewTiddler*has field: *backup-1*
field backup-1 has value : *somevalue*

When *NewTiddler* is being viewed or edited, this macro in its text field 
*<>*  should give a result of : *somevalue*


On Wednesday, February 13, 2019 at 7:58:14 AM UTC+7, 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/<>"
> 
> \end
>
> \define backup(value)
> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
> 
> 
> \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+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/cbec91dc-9b48-49a5-92b8-1795409119e9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-13 Thread TonyM
Thanks Jeremy,

Similer to other widgets, I suppose this is a way to do the same as the tiddler 
widget but with the posibility of emptyvalue etc...

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 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/eca1d45e-2ca5-472a-8771-48fe42a6f5a7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-13 Thread Jeremy Ruston
Hi Adam

The docs are correct, the "name" attribute of the <$set> widget defaults to 
"currentTiddler" if not present.

Best wishes

Jeremy

--
Jeremy Ruston
jer...@jermolene.com
https://jermolene.com

> On 13 Feb 2019, at 08:04, admls  wrote:
> 
> The tiddlywiki.com documentation on the set widget says this about the name 
> parameter: 'The name of the variable to assign (defaults to 
> "currentTiddler")'.
> 
> Does that just need updated or something? Or am I misunderstanding it?
> 
> -- 
> 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/44695e55-ac26-430b-8d06-5846fd008970%40googlegroups.com.
> 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/35246AA0-1E8D-45B4-B935-65A09F0CE791%40gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-13 Thread admls
The tiddlywiki.com documentation on the set widget says this about the name 
parameter: 'The name of the variable to assign (defaults to "currentTiddler")'.

Does that just need updated or something? Or am I misunderstanding it?

-- 
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/44695e55-ac26-430b-8d06-5846fd008970%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-12 Thread TonyM
As mal says, If you use set you are defining a value/variable you must name 
it name=myvar you can give it a value=<>

Regards
tony

On Wednesday, February 13, 2019 at 6:35:44 PM UTC+11, admls wrote:
>
> Hi Tony,
>
> My understanding is that if the name parameter is left out of the set 
> widget, the variable name defaults to "currentTiddler". I could be 
> mistaken, of course.
>
>
> Hi Mark,
>
> That doesn't seem to be working for me. It's acting like there is nothing 
> at those fields, but I've made sure that there are some values there.
>
>
> Best wishes,
> Adam
>
> On Wednesday, February 13, 2019 at 4:02:42 AM UTC, Mark S. wrote:
>>
>> Hello Adam,
>>
>> The following version works.
>>
>> \define concatStateTiddler()
>> <$set filter="[all[current]get[draft.of]] [all[current]!has[draft.of]] 
>> +[addprefix[$:/state/]]" name="kitty"><$text text=<>/>
>> \end
>>
>> \define backup(value)
>> <$wikify text=<> name=cst>
>> <$view tiddler=<> field="""$value$"""/>
>> 
>> \end
>>
>>
>> You can't concatenate a <> 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/<>"
>>> 
>>> \end
>>>
>>> \define backup(value)
>>> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>>>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
>>> 
>>> 
>>> \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+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/7cd1b6b4-7f2c-4808-995f-abaafe83380d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-12 Thread Mal
Hi Adam,

I think you might be getting the set widget confused with the list widget.  
With the list widget, there is a parameter called "variable" that defaults to 
"currentTiddler".

Regards,

Mal

-- 
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/c8220888-0160-4f0b-a609-bb50c453589e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-12 Thread admls
Hi Tony,

My understanding is that if the name parameter is left out of the set 
widget, the variable name defaults to "currentTiddler". I could be 
mistaken, of course.


Hi Mark,

That doesn't seem to be working for me. It's acting like there is nothing 
at those fields, but I've made sure that there are some values there.


Best wishes,
Adam

On Wednesday, February 13, 2019 at 4:02:42 AM UTC, Mark S. wrote:
>
> Hello Adam,
>
> The following version works.
>
> \define concatStateTiddler()
> <$set filter="[all[current]get[draft.of]] [all[current]!has[draft.of]] 
> +[addprefix[$:/state/]]" name="kitty"><$text text=<>/>
> \end
>
> \define backup(value)
> <$wikify text=<> name=cst>
> <$view tiddler=<> field="""$value$"""/>
> 
> \end
>
>
> You can't concatenate a <> 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/<>"
>> 
>> \end
>>
>> \define backup(value)
>> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
>> 
>> 
>> \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+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/809bf23b-c06c-4b39-9b85-ebf2fa863942%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-12 Thread 'Mark S.' via TiddlyWiki
Hello Adam,

The following version works.

\define concatStateTiddler()
<$set filter="[all[current]get[draft.of]] [all[current]!has[draft.of]] 
+[addprefix[$:/state/]]" name="kitty"><$text text=<>/>
\end

\define backup(value)
<$wikify text=<> name=cst>
<$view tiddler=<> field="""$value$"""/>

\end


You can't concatenate a <> 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/<>"
> 
> \end
>
> \define backup(value)
> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
> 
> 
> \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+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/ab4280b0-84b5-4447-b516-9dc1d6898885%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw5]Macro interactions

2019-02-12 Thread TonyM
Adam,

I do not understand the Question, Others may, However in your set statement 
you are not providing or using the name= parameter so I am not sure what is 
happening other than in your second example.

Regards
Tony

On Wednesday, February 13, 2019 at 11:58:14 AM UTC+11, 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/<>"
> 
> \end
>
> \define backup(value)
> <$view tiddler=$(concatStateTiddler)$ field="""$value$""">
>  <$view tiddler="$:/config/backup-values" field="""backup-$value$""">
> 
> 
> \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+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/254a929f-7304-4d06-9a9d-74847181bde0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.