On Saturday, December 9, 2017 at 5:49:58 PM UTC-8, John wrote:
>
> Thank you Eric for your comprehensive answer.
> I have three more questions while I have your attention:
>
> 1- How to force the custom search to ignore case?
>
I can do this by typing (?i)(Some Example) in the input box and it works.
> I want to put it in the custom search tiddler code. I tried all
> combinations of brackets around $:/temp/mysearch but nothing worked.
This is a bit more complex... but only a little. The trick is to define a
macro (e.g., "makefilter") that assembles the complete filter syntax using
a variable, like this:
\define makefilter() [regexp[(?i)$(pattern)$]] [regexp:text[(?i)$(pattern)$
]] -[title[$:/temp/mysearch]]
<$edit-text tiddler="$:/temp/mysearch" tag="input" default=""/><br>
<$reveal state="$:/temp/mysearch" type="nomatch" text="">
<$vars pattern={{$:/temp/mysearch}}>
<$count filter=<<makefilter>>/> matches:<br>
<$macrocall $name="list-links" filter=<<makefilter>>/>
</$vars>
</$reveal>
* The "makefilter()" macro uses a variable named "pattern" that is defined
outside the macro itself
* The $vars widget retrieves the value stored in $:/temp/mysearch and sets
the "pattern" variable, which surrounds the call to the list-links macro
* You can't use a variable reference as a parameter in the <<list-links
...>> macro syntax, so we use the underlying <$macrocall> widget syntax
instead
* Note: I added a bit of extra output using the <$count> widget to show the
number of matching results
> 2- How to replace the standard search with the new custom search?
>
The standard search interface is defined within the $:/core/ui/SideBarLists
shadow tiddler, which also defines the output of the tabbed lists below the
search. To use your custom search, you can replace most of the content in
$:/core/ui/SideBarLists, like this:
<div class="tc-sidebar-lists">
{{MySearch}}
<$macrocall $name="tabs"
tabsList="[all[shadows+tiddlers]tag[$:/tags/SideBar]!has[draft.of]]"
default={{$:/config/DefaultSidebarTab}} state="$:/state/tab/sidebar" />
</div>
To make the custom search look nice in the sidebar, you can also add some
styling to the MySearch definition by surrounding the $macrocall within a
<div>...</div> block, like this:
<div class="tc-block-dropdown tc-search-drop-down">
<$macrocall $name="list-links" filter=<<makefilter>>>
</div>
* The <div> uses the same class definitions ("tc-block-dropdown
tc-search-drop-down") as the standard search results. This makes the
custom search results "float" on top of the sidebar lists, and gives it a
nice surrounding box with rounded corners and drop shadow.
> 3- In classic TW, I used to search long tiddlers by pressing ctl-F in the
> browser window. With TW5 under NW, is there a way to have a "find" function
> similar to ctl-F of the browser?
>
I just use the browser's ctrl-F function, the same way as in TWClassic.
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 [email protected].
To post to this group, send email to [email protected].
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/4b187f64-204e-474c-a502-3a43264a637c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.