search text saved

49 views
Skip to first unread message

Ed Heil

unread,
Apr 28, 2020, 11:39:44 AM4/28/20
to TiddlyWiki
I've come up against this minor annoyance a lot...  I'll save a tiddlywiki, and then upload it to someplace public, and when I visit it there, I notice that I left some search text in the search box and now the results are popping up.  (They won't have been visible when I was editing it because I clicked out of the results box, which is why I forgot them.)

Is there any way around this besides "remember to delete the search box contents and save before you upload"?   Maybe some way to specify that search box contents/results do not have to be saved as part of the wiki state?  Or if they are saved, the results don't have to be displayed on page load?  Or failing that, maybe some simple tiddlywiki command line that I can run to programmatically remove them before I upload? 

Just thought I'd check.

Thanks,

Ed

Eric Shulman

unread,
Apr 28, 2020, 12:07:56 PM4/28/20
to TiddlyWiki
On Tuesday, April 28, 2020 at 8:39:44 AM UTC-7, Ed Heil wrote:
some way to specify that search box contents/results do not have to be saved as part of the wiki state?

The sidebar search input is stored in $:/temp/search,
and the $:/AdvancedSearch input is stored in $:/temp/advancedsearch

The filter that determines what is saved in the file is defined in $:/core/save/all, which contains:
\import [[$:/core/ui/PageMacros]] [all[shadows+tiddlers]tag[$:/tags/Macro]!has[draft.of]]
\define saveTiddlerFilter()
[is[tiddler]] -[prefix[$:/state/popup/]] -[[$:/HistoryList]] -[[$:/boot/boot.css]] -[type[application/javascript]library[yes]] -[[$:/boot/boot.js]] -[[$:/boot/bootprefix.js]] +[sort[title]] $(publishFilter)$
\end
{{$:/
core/templates/tiddlywiki5.html}}

Note the $(publishFilter)$ reference in the saveTiddlerFilter() definition.  This macro variable can be used to list additional tiddlers that should be excluded when saving the file.

Thus, to prevent the search inputs from being saved all you need to do is to create a global macro tiddler (e.g., "MyPublishFilter", tagged with "$:/tags/Macro") like this:
\define publishFilter() -[[$:/temp/search]] -[[$:/temp/advancedsearch]]

When you save your document, those two tiddlers will no longer be included.  As a result, when you reload the file, the search inputs will default to blank, as desired.

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)

Ed Heil

unread,
Apr 28, 2020, 2:25:28 PM4/28/20
to TiddlyWiki
Thanks, that's exactly what I was looking for.
Reply all
Reply to author
Forward
0 new messages