Need another filter

163 views
Skip to first unread message

David Gifford

unread,
Jul 22, 2016, 7:08:31 PM7/22/16
to TiddlyWiki
Hi all

Am trying to do a special list filter:

"List all tiddlers whose article field is the current tiddler's title."

I had

<$list filter="[article{!!title}]">

which works for one word titles, but then when the current tiddler's title is more than one word, nothing gets displayed.

Dave

c pa

unread,
Jul 22, 2016, 8:10:53 PM7/22/16
to TiddlyWiki
\define List_Articles(article, template)
    <$list filter="[field:article[$article$]]">
         $template$
    </$list>
\end

<$macrocall $name="List_Articles" article={{!!title}}
template="""

    Code to be run per article such as listing the title:
    {{!!title}}

"""/>

And yes. It does seem to be overkill. I've learned to live with overkill.

David Gifford

unread,
Jul 22, 2016, 8:16:12 PM7/22/16
to tiddl...@googlegroups.com
Hi c pa

I probably should have included the complete list filter. I am not sure how to integrate this with what you just sent me

<$list filter="article{!!title}]">

<$transclude field="text" mode="block"/>

<span class="source"><$link field="title"><$view field="source"/> - <$view field="modified" format="date" template="YYYY MMM"/></$link></span>

<hr>

</$list>

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/AY6P-tro51o/unsubscribe.
To unsubscribe from this group and all its topics, 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/698591ce-4c1a-4550-bf4a-15902a2f934b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
David Gifford
Christian Reformed World Missions, Mexico City

David Gifford

unread,
Jul 22, 2016, 8:16:44 PM7/22/16
to tiddl...@googlegroups.com
It will be in a tiddler tagged $:/tags/ViewTemplate

Dave

RichardWilliamSmith

unread,
Jul 24, 2016, 1:37:12 AM7/24/16
to TiddlyWiki
Hi Dave,

I tested the filter in your OP and it worked for me with titles that have multiple words.

I also tested the full snippet and found there is a [ missing before article, but other than that, this also seems to work.

c pa's solution is pretty cool, too.

Regards,
Richard

c pa

unread,
Jul 24, 2016, 1:57:29 AM7/24/16
to TiddlyWiki
\define List_Articles(article)
    <!-- find all tiddlers that have field article = this tiddler  -->
    <$list filter="[field:article[$article$]]" variable="article_tiddler">
        <!-- Show the contents of that tiddler  -->
        <$transclude tiddler=<<article_tiddler>> field="text" mode="block"/>
        <!-- wrap the next bit in a styled span -->
        <span class="source">
             <!-- Provide a link that will open that tiddler -->
             <$link to=<<article_tiddler>> >
                    <!-- Display the source field of that tiddler (not the title) -->
                    <$view tiddler=<<article_tiddler>> field="source"/> -
                    <!-- Display the modifed date of that tiddler -->
                    <$view tiddler=<<article_tiddler>> field="modified" format="date" template="YYYY MMM"/>
              </$link>
         </span>
         <hr>
    </$list>
\end

<$macrocall $name="List_Articles" article={{!!title}} />


David Gifford

unread,
Jul 26, 2016, 7:55:54 AM7/26/16
to TiddlyWiki
okay, this is working for others but not for me.

Here is the file it is not working in. http://giffmex.org/experiments/7-22.html

Conpare the tiddler "Words", which shows the two tiddlers with that title in their articles field, and the tiddler "Reading, notes on", which does not show the tiddler that should be there.

The viewtemplate tiddler being used is $:/.ChildrenArticles

What am I doing wrong??? Any ideas?

Dave

RichardWilliamSmith

unread,
Jul 26, 2016, 9:53:45 AM7/26/16
to TiddlyWiki
Hi Dave,

It seems to be because of the [[ ]] brackets around the entry in the article field on the tiddler 2016-07-22 17:31:50 - if I remove them, the transclusion works, but the tags break up into separate words.

I guess this is to do with the way that you have re-used the tag mechanism. The fix probably depends on whether you need each tiddler to have multiple "article tags" (fix the template) or only one (fix the tag-like interface).

Regards,
Richard

David Gifford

unread,
Jul 26, 2016, 9:55:00 AM7/26/16
to tiddl...@googlegroups.com
Yes, I will have multiple items in the article field. Hmmm

Dave

--
You received this message because you are subscribed to a topic in the Google Groups "TiddlyWiki" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/tiddlywiki/AY6P-tro51o/unsubscribe.
To unsubscribe from this group and all its topics, 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.

For more options, visit https://groups.google.com/d/optout.

RichardWilliamSmith

unread,
Jul 26, 2016, 10:37:45 AM7/26/16
to TiddlyWiki
Hi Dave,

I *think* you can fix it by changing the filter in the view template to [is[current]listed[article]] 

(selects the current tiddler title and then looks for that title listed in the article field of other tiddlers)

I had to fiddle for a bit to get it to work and it's bed time now, but I think it works. 

Good Luck!

Regards,
Richard

David Gifford

unread,
Jul 28, 2016, 8:23:39 AM7/28/16
to tiddl...@googlegroups.com
Hi Richard

Sorry for the delay in responding. My wife and I went on a two day getaway without the computer. :-)

Thank you for the snippet, it worked perfectly!

Dave


For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages