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

Best,
X.


-- Xavier Cazin

On Fri, Dec 1, 2017 at 9:29 PM, Diego Mesa <diego...@gmail.com> wrote:

> After reading/searching/experimenting I got:
>
> <$list filter="[is[current]fields[]regexp[-url]]" variable="fieldname">
> <$list filter="[<fieldname>split:before[-]]" variable="fieldprint">
> <$text text=<<fieldprint>>/>: <$view  field=<<fieldname>> /> <br/>
> </$list>
> </$list>
>
> There is still some confusion about the use of << vs < when referencing
> variables, and why I don't have to wrap <fieldname> with [<fieldname>]
> before giving it to split.
>
> Remaining issues:
>
>    - actually making those render as URLs
>    - If I replace the <br/> 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=<<fieldprint>>/>|<$view field=<<fieldname>> />]]   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="[[<<fieldname>>]split:before[-]]" variable="fieldprint">
>> <$text text=<<fieldprint>>/> : <$view  field=<<fieldname>>/> <br>
>> </$list>
>> </$list>
>>
>> But this does not work. Without the split-before it renders as:
>>
>> <<fieldname>> : test1.com
>> <<fieldname>> : test2.com
>> <<fieldname>> : test3.com
>>
>> which signifies that the <<fieldname>> 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
> <https://groups.google.com/d/msgid/tiddlywiki/bab03871-17c7-4274-a4b4-4e3647973723%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/CADeSwYMDdxk1mgnmWSd7AmZ%3DKhKZ8WeP_zQ8o2tjxN4mE6ce3g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to