Yes Eric that is exactly what I meant. It's basically a location search
for common gedcom tags (which are not the same as TiddlyWiki tags.)
Thanks so much for the examples.
I have been reading about macros but I still don't think I grasp them fully
yet. However, though experimentation I have come up with the following 2
examples which give me better control over the title lists. The first works
fine. I prefer the 2nd example as it's more general. I think it can
generalize even more into a macro named "location-search" maybe. Something
similar to <<location-search "California">>
First Example:
\define searchflds()
<$list filter="[search:$(flds)$[California]]">
</$list>
\end
<$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
<<searchflds>>
</$vars>
Second Example:
\define search-filter(term) [search:$(flds)$[$term$]]
<$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
<$list filter=<<search-filter "germany">> >
<$link>{{!!caption}}</$link> {{||year-span}}<br>
</$list>
</$vars>
On Saturday, August 29, 2020 at 2:40:50 PM UTC-4 Eric Shulman wrote:
> On Saturday, August 29, 2020 at 11:24:46 AM UTC-7, Eric Shulman wrote:
>>
>> \define searchflds() {{{ [search:$(flds)$[query]] }}}
>>
>> <$list filter="[fields[]regexp[_plac$]]" variable="flds">
>> <<searchflds>>
>> </$list>
>>
>
> Addendum:
>
> The above code will work, but... it searches for each field name
> separately. As a result, if there are multiple fieldnames in the same
> tiddler that contain the query text, that tiddler will be listed multiple
> times.
>
> Your intuition to use "join[,]" to construct a list of fields is actually
> the better approach. Thus:
> \define searchflds() {{{ [search:$(flds)$[query]] }}}
>
> <$vars flds={{{ [fields[]regexp[_plac$]join[,]] }}}>
> <<searchflds>>
> </$vars>
>
> Notes:
> * the $vars finds all fieldnames ending in "_plac" and assembles a
> comma-separated list
> * the searchflds macro then uses that list of fieldnames to find the
> occurrences of "query" within any of those fields
>
> Because the search is looking in all of the "_plac" fieldnames at the same
> time, any matching tiddlers are only listed once.
>
> -e
>
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/ba6d9962-0a56-425e-bdd3-c03fa488a102n%40googlegroups.com.