[tw] Re: Using variables in nested lists

2017-12-03 Thread Diego Mesa
Thanks for this explanation Eric! I've made a note in my wiki! 

On Saturday, December 2, 2017 at 11:24:52 PM UTC-6, Eric Shulman wrote:
>
> On Saturday, December 2, 2017 at 7:29:05 PM UTC-8, Diego Mesa wrote:
>>
>> Can some one clarify on the use of << vs < when referencing variables...
>>
>
> In TiddlyWiki *content*, variables are referenced using <>.  
> The double-bracket syntax is used to avoid conflicts with standard HTML 
> syntax (i.e.,  starts normal HTML bold formatting, while <> embeds 
> the value of a TiddlyWiki variable named "b")
>
> However, within TiddlyWiki *filters*, there is no need doubling the 
> brackets, as HTML is not allowed *within* the filter, so only single 
>  is used.
>
> ...and why I don't have to wrap  with [] before 
>> giving it to split. 
>
>
> Think of the brackets in filters as part of the operand itself rather than 
> a "container" for the operand.  The type of bracket indicates the type of 
> operand being used:
>use [...] for literal values, e.g., [texthere] 
>use {...} for field references, e.g., {!!fieldname}
>use <...> for variables e.g. 
>
> Thus, to split the literal text, "sometext", you could write:
>[title[sometext]splitbefore[t]removesuffix[t]]
> you would get "some" as a result.
>
> If the value "sometext" is stored in a field named "somefield" in the 
> current tiddler, you could write:
>   [{!!somefield}splitbefore[t]removesuffix[t]]
>
> and, if the value "sometext" is stored in a variable named "somevariable", 
> you could write:
>   [splitbefore[t]removesuffix[t]]
>
> As a slightly more complex example, suppose the value to split on was also 
> stored in a variable.  Then you could write:
>   [splitbeforeremovesuffix]
>
> hope this helps,
>
> enjoy,
> -e
> Eric Shulman
> TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
> InsideTiddlyWiki: The Missing Manuals
>

-- 
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/e7492630-a0b8-4c06-9218-d6d5f5117784%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Using variables in nested lists

2017-12-02 Thread Eric Shulman
On Saturday, December 2, 2017 at 7:29:05 PM UTC-8, Diego Mesa wrote:
>
> Can some one clarify on the use of << vs < when referencing variables...
>

In TiddlyWiki *content*, variables are referenced using <>.  
The double-bracket syntax is used to avoid conflicts with standard HTML 
syntax (i.e.,  starts normal HTML bold formatting, while <> embeds 
the value of a TiddlyWiki variable named "b")

However, within TiddlyWiki *filters*, there is no need doubling the 
brackets, as HTML is not allowed *within* the filter, so only single 
 is used.

...and why I don't have to wrap  with [] before 
> giving it to split. 


Think of the brackets in filters as part of the operand itself rather than 
a "container" for the operand.  The type of bracket indicates the type of 
operand being used:
   use [...] for literal values, e.g., [texthere] 
   use {...} for field references, e.g., {!!fieldname}
   use <...> for variables e.g. 

Thus, to split the literal text, "sometext", you could write:
   [title[sometext]splitbefore[t]removesuffix[t]]
you would get "some" as a result.

If the value "sometext" is stored in a field named "somefield" in the 
current tiddler, you could write:
  [{!!somefield}splitbefore[t]removesuffix[t]]

and, if the value "sometext" is stored in a variable named "somevariable", 
you could write:
  [splitbefore[t]removesuffix[t]]

As a slightly more complex example, suppose the value to split on was also 
stored in a variable.  Then you could write:
  [splitbeforeremovesuffix]

hope this helps,

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

-- 
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/6c2f5349-942b-478e-8168-b254c3ec2757%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Using variables in nested lists

2017-12-02 Thread Diego Mesa
Can some one clarify on the use of << vs < when referencing variables, and 
why I don't have to wrap  with [] before giving it to 
split. 

Thanks!

On Friday, December 1, 2017 at 3:07:43 PM UTC-6, Jed Carty wrote:
>
> Sorry, looking at that now it isn't obvious what I am talking about but it 
> looks like you already have the same idea anyway using last and butlast.
>

-- 
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/dd1fba42-e9cc-4200-9a53-739f528c50d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Using variables in nested lists

2017-12-01 Thread Jed Carty
Sorry, looking at that now it isn't obvious what I am talking about but it 
looks like you already have the same idea anyway using last and butlast.

-- 
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/a1826a3e-34ba-4c87-958d-f0bfaea64875%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Using variables in nested lists

2017-12-01 Thread Jed Carty
For getting rid of the last comma, the same method I demonstrated here 
should work: 
https://groups.google.com/d/msg/tiddlywiki/D5CQvz_CpYw/0J0phbL4AwAJ

-- 
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/b7cebf0f-6d7e-465a-bf83-4fa183476599%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Using variables in nested lists

2017-12-01 Thread Diego Mesa
Thanks Xavier! I think that butlast and last will work! 

On Friday, December 1, 2017 at 2:49:10 PM UTC-6, Xavier wrote:
>
> Hi Diego,
>
> I think the following butlast/last trick was given by Jed Carty a few 
> hours ago. It looks quite verbose because the outer list is essentially 
> duplicated, but I think it handles your three issues.
>
> <$list filter="[is[current]fields[]regexp[-url]butlast[]]" 
> variable="fieldname">
> <$list filter="[splitbefore[-]removesuffix[-]]" 
> variable="fieldprint">
> <$text text=<>/> : <$link to=<>><$view  
> field=<>/>,
> 
> 
> <$list filter="[is[current]fields[]regexp[-url]last[]]" 
> variable="fieldname">
> <$list filter="[splitbefore[-]removesuffix[-]]" 
> variable="fieldprint">
> <$text text=<>/> : <$link to=<>><$view  
> field=<>/>.
> 
> 
>
> Best,
> X.
>
>
> -- Xavier Cazin
>
> On Fri, Dec 1, 2017 at 9:29 PM, Diego Mesa  > wrote:
>
>> After reading/searching/experimenting I got:
>>
>> <$list filter="[is[current]fields[]regexp[-url]]" variable="fieldname">
>> <$list filter="[split:before[-]]" variable="fieldprint">
>> <$text text=<>/>: <$view  field=<> /> 
>> 
>> 
>>
>> There is still some confusion about the use of << vs < when referencing 
>> variables, and why I don't have to wrap  with [] 
>> before giving it to split. 
>>
>> Remaining issues:
>>
>>- actually making those render as URLs
>>- If I replace the  with a comma to get them all on one line, 
>>I'm left with a trailing comma
>>- If I instead try to generate external links as:  [[<$text 
>>text=<>/>|<$view field=<> />]]   it doesn't work. 
>>
>> There is still some residual confusion about using nested lists as nested 
>> for loop analogs, and how to actually use the variables in the "loops".
>>
>>
>> On Friday, December 1, 2017 at 2:04:41 PM UTC-6, Diego Mesa wrote:
>>>
>>> Hey all,
>>>
>>> I am trying to display a header for all posts tagged PoI that does, 
>>> among other things, display any urls I've placed in its fields. For 
>>> example, If I have a tiddler with the following fields:
>>>
>>> paper-url: test1.com
>>> hn-url: test2.com
>>> blog-url: test3.com
>>>
>>> I would like to have displayed
>>>
>>> Paper: test1.com
>>> HN: test2.com
>>> Blog: test3.com
>>>
>>> as the header. This is what I have so far:
>>>
>>> <$list filter="[is[current]fields[]regexp[-url]]" variable="fieldname">
>>> <$list filter="[[<>]split:before[-]]" variable="fieldprint">
>>> <$text text=<>/> : <$view  field=<>/> 
>>> 
>>> 
>>>
>>> But this does not work. Without the split-before it renders as:
>>>
>>> <> : test1.com 
>>> <> : test2.com
>>> <> : test3.com
>>>
>>> which signifies that the <> isn't getting substituted 
>>> correctly in the inner list. I tried adding a <$set> between the nesting, 
>>> but that didn't work either. 
>>>
>>> Any specific (and general!) help would be greatly appreciated!
>>> Diego
>>>
>>>
>>> -- 
>> 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/bab03871-17c7-4274-a4b4-4e3647973723%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/c4adf5a6-3ae9-4a44-abe2-5fbd295d513e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [tw] Re: Using variables in nested lists

2017-12-01 Thread Xavier Cazin
Hi Diego,

I think the following butlast/last trick was given by Jed Carty a few hours
ago. It looks quite verbose because the outer list is essentially
duplicated, but I think it handles your three issues.

<$list filter="[is[current]fields[]regexp[-url]butlast[]]"
variable="fieldname">
<$list filter="[splitbefore[-]removesuffix[-]]"
variable="fieldprint">
<$text text=<>/> : <$link to=<>><$view
field=<>/>,


<$list filter="[is[current]fields[]regexp[-url]last[]]"
variable="fieldname">
<$list filter="[splitbefore[-]removesuffix[-]]"
variable="fieldprint">
<$text text=<>/> : <$link to=<>><$view
field=<>/>.



Best,
X.


-- Xavier Cazin

On Fri, Dec 1, 2017 at 9:29 PM, Diego Mesa  wrote:

> After reading/searching/experimenting I got:
>
> <$list filter="[is[current]fields[]regexp[-url]]" variable="fieldname">
> <$list filter="[split:before[-]]" variable="fieldprint">
> <$text text=<>/>: <$view  field=<> /> 
> 
> 
>
> There is still some confusion about the use of << vs < when referencing
> variables, and why I don't have to wrap  with []
> before giving it to split.
>
> Remaining issues:
>
>- actually making those render as URLs
>- If I replace the  with a comma to get them all on one line, I'm
>left with a trailing comma
>- If I instead try to generate external links as:  [[<$text
>text=<>/>|<$view field=<> />]]   it doesn't work.
>
> There is still some residual confusion about using nested lists as nested
> for loop analogs, and how to actually use the variables in the "loops".
>
>
> On Friday, December 1, 2017 at 2:04:41 PM UTC-6, Diego Mesa wrote:
>>
>> Hey all,
>>
>> I am trying to display a header for all posts tagged PoI that does, among
>> other things, display any urls I've placed in its fields. For example, If I
>> have a tiddler with the following fields:
>>
>> paper-url: test1.com
>> hn-url: test2.com
>> blog-url: test3.com
>>
>> I would like to have displayed
>>
>> Paper: test1.com
>> HN: test2.com
>> Blog: test3.com
>>
>> as the header. This is what I have so far:
>>
>> <$list filter="[is[current]fields[]regexp[-url]]" variable="fieldname">
>> <$list filter="[[<>]split:before[-]]" variable="fieldprint">
>> <$text text=<>/> : <$view  field=<>/> 
>> 
>> 
>>
>> But this does not work. Without the split-before it renders as:
>>
>> <> : test1.com
>> <> : test2.com
>> <> : test3.com
>>
>> which signifies that the <> isn't getting substituted
>> correctly in the inner list. I tried adding a <$set> between the nesting,
>> but that didn't work either.
>>
>> Any specific (and general!) help would be greatly appreciated!
>> Diego
>>
>>
>> --
> 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/bab03871-17c7-4274-a4b4-4e3647973723%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/CADeSwYMDdxk1mgnmWSd7AmZ%3DKhKZ8WeP_zQ8o2tjxN4mE6ce3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[tw] Re: Using variables in nested lists

2017-12-01 Thread Diego Mesa
After reading/searching/experimenting I got:

<$list filter="[is[current]fields[]regexp[-url]]" variable="fieldname">
<$list filter="[split:before[-]]" variable="fieldprint">
<$text text=<>/>: <$view  field=<> /> 



There is still some confusion about the use of << vs < when referencing 
variables, and why I don't have to wrap  with [] 
before giving it to split. 

Remaining issues:

   - actually making those render as URLs
   - If I replace the  with a comma to get them all on one line, I'm 
   left with a trailing comma
   - If I instead try to generate external links as:  [[<$text 
   text=<>/>|<$view field=<> />]]   it doesn't work. 

There is still some residual confusion about using nested lists as nested 
for loop analogs, and how to actually use the variables in the "loops".


On Friday, December 1, 2017 at 2:04:41 PM UTC-6, Diego Mesa wrote:
>
> Hey all,
>
> I am trying to display a header for all posts tagged PoI that does, among 
> other things, display any urls I've placed in its fields. For example, If I 
> have a tiddler with the following fields:
>
> paper-url: test1.com
> hn-url: test2.com
> blog-url: test3.com
>
> I would like to have displayed
>
> Paper: test1.com
> HN: test2.com
> Blog: test3.com
>
> as the header. This is what I have so far:
>
> <$list filter="[is[current]fields[]regexp[-url]]" variable="fieldname">
> <$list filter="[[<>]split:before[-]]" variable="fieldprint">
> <$text text=<>/> : <$view  field=<>/> 
> 
> 
>
> But this does not work. Without the split-before it renders as:
>
> <> : test1.com 
> <> : test2.com
> <> : test3.com
>
> which signifies that the <> isn't getting substituted correctly 
> in the inner list. I tried adding a <$set> between the nesting, but that 
> didn't work either. 
>
> Any specific (and general!) help would be greatly appreciated!
> Diego
>
>
>

-- 
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/bab03871-17c7-4274-a4b4-4e3647973723%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.