custom search bar reaults span broken

22 views
Skip to first unread message

A Gloom

unread,
Feb 8, 2022, 10:12:43 AM2/8/22
to TiddlyWiki
I created a custom search bar results for the main search bar.  Everything works except each search result shows a ' </span>' at their end. This only happens in the second list, which I replaced the second filter field transclusion with a macro.  So that may be the issue-- the macro breaking the span.

Attached is a json file with the 2 tiddlers needed to test it at TW . com
Also let me know if i incorporated the regexp (second list for searching beginnings of words, the first search beginning of title only) properly.  I'm still figuring out why the count isn't registering properly

As always, thank you in advance.

$:/.wt/ModSearchResultListTitle
```
\define var-wordbegins() [!is[system]search:title,caption:regexp[\b$(srchbrval)$]sort[title]limit[250]]
\define searchResultList()
<$set name="srchbrval" value=<<userInput>>>
//<small>Beginning of title</small>//

<$list filter="[<userInput>minlength[1]]" variable="ignore">
<$list filter={{{ [<configTiddler>get[first-search-filter]] }}}>
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/>
</span>
</$list>
</$list>
<hr style="margin:5px auto 0px;"/>//<small>Any word in title</small>//<hr style="margin:0px auto;"/>
<$list filter="[<userInput>minlength[1]]" variable="ignore">
<$list filter=<<var-wordbegins>>
<span class={{{[<currentTiddler>addsuffix[-secondaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/>
</span>
</$list>
</$list>
</$set>
\end
<small>Searches titles & (alternate titles) only</small><br/>
<<searchResultList>>
```

$:/.wt/ModSearchResultListTitle

\define var-wordbegins() [!is[system]search:title,caption:regexp[\b$(srchbrval)$]sort[title]limit[250]]
\define searchResultList()
<$set name="srchbrval" value=<<userInput>>>
//<small>Beginning of title</small>//

<$list filter="[<userInput>minlength[1]]" variable="ignore">
<$list filter={{{ [<configTiddler>get[first-search-filter]] }}}>
<span class={{{[<currentTiddler>addsuffix[-primaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/>
</span>
</$list>
</$list>
<hr style="margin:5px auto 0px;"/>//<small>Any word in title</small>//<hr style="margin:0px auto;"/>
<$list filter="[<userInput>minlength[1]]" variable="ignore">
<$list filter=<<var-wordbegins>>
<span class={{{[<currentTiddler>addsuffix[-secondaryList]] -[<searchListState>get[text]] +[then[]else[tc-list-item-selected]] }}}>
<$transclude tiddler="$:/.wt/ui/ListItemTemplateTitleCaption"/>
</span>
</$list>
</$list>
</$set>
\end
<small>Searches titles & (alternate titles) only</small><br/>
<<searchResultList>>
```
first-search-filter:

[!is[system]search:title,caption:literal,anchored<userInput>sort[title]limit[250]]

second-search-filter:
[!is[system]search:title,caption:regexp<var-wordbegins>sort[title]limit[250]]

$:/.wt/ui/ListItemTemplateTitleCaption
```
<div class="tc-menu-list-item">
<$link><$view field="title"/></$link> <$list filter="[<currentTiddler>has[caption]]">(<$view field="caption"/>)</$list>
</div>
```
modifiedsearchbarresults.json
Reply all
Reply to author
Forward
0 new messages