How to modify the text of standard search?

100 views
Skip to first unread message

bimlas

unread,
Nov 27, 2018, 3:27:09 AM11/27/18
to TiddlyWiki
Hi!

I would like to change the standard search text, or more specifically to grab texts starting with # so that I can find them among the tags. Add the `$:/tags/SearchResults` tag to this tiddler and watch the results only in standard search (where $(searchTiddler)$ is exists).

\define wikifyMe() <$list filter="[enlist{$(searchTiddler)$}removeprefix[#]]"/>

\define searchResultList()
Search tiddler: $(searchTiddler)$

Searched text: {{$(searchTiddler)$}}

Tags without wikification: <<wikifyMe>>

<$wikify $name="wikified" text=<<wikifyMe>> >

Tags with wikification: <<wikified>>

Search for tags with wikification: 
<$list filter="""[search:tags<wikified>]"""/>

</$wikify>

Standard search: 
<$list filter="""[search{$(searchTiddler)$}]"""/>

\end
<<searchResultList>>

The wikifyMe works only without wikification, when it's wikified, the output is empty, thus the searching not works as expected. As I look at, transclusion does not work for the term, but I can not determine exactly what's wrong.

I attached the tiddler.

PS.: $(searchTiddler)$ only exists if the whole stuff is encapsulated in to a macro (searchResultList), but without it it's not defined - is this intended?
tiddlers.json

Mark S.

unread,
Nov 27, 2018, 12:33:10 PM11/27/18
to TiddlyWiki

I think the answer is that the scope of $()$ variables (actually placeholders) is Lexical, which is a fancy way of saying "I don't have a clue what I'm saying, but that sounded good".

My workaround was to wikify the output of $(searchTiddler)$ so it could be used directly as a variable in the list filter.

Also, note that in <$wikify> the attribute is name, not $name.

Have fun
-- Mark


\define getValue(tid) {{$tid$}}
\define wikifyMe() <$list filter="[enlist<searchUs>removeprefix[#]]"/>

\define searchResultList()
Search tiddler: $(searchTiddler)$
Search tiddler: <<searchTiddler>>


Searched text: {{$(searchTiddler)$}}

Tags without wikification: <<wikifyMe>>

<$wikify name="searchUs" text="<$macrocall $name='getValue' tid=<<searchTiddler>>/>">

<$wikify name="wikified" text=<<wikifyMe>> >


Tags with wikification: <<wikified>>

Search for tags with wikification:
<$list filter="""[search:tags<wikified>]"""/>

</$wikify>
</
$wikify>

Standard search:
<$list filter="""[search{$(searchTiddler)$}]"""/>

\end
<<searchResultList>>

TonyM

unread,
Nov 27, 2018, 5:44:21 PM11/27/18
to TiddlyWiki
Mark,

Your use of the word lexical reminds me of a friend, an electrical engineer and amature astronomer. When he did not know an answer he would respond something like this

It is due to the electrocentrafication of illuminence of the bio capacitance of thin films

or some similar sophisticated nonsense.

Tony

bimlas

unread,
Nov 28, 2018, 1:47:56 AM11/28/18
to TiddlyWiki
@Mark:
Thank you very much, it works perfectly!

So far I just guessed, but now I'm sure: Tiddly is not about Clean Coding ("Clean code is code that is easy to understand and easy to change."). :)

bimlas

unread,
Nov 28, 2018, 3:14:51 AM11/28/18
to TiddlyWiki
Also, note that in <$wikify> the attribute is name, not $name.
 
@Mark, I'm not sure about this: The macrocall documentation does not mention directly to use the dollar sign, but the macrocall examples include the dollar sign and it does not works without it.

Issue about macrocall name parameter.json

bimlas

unread,
Nov 28, 2018, 3:15:40 AM11/28/18
to TiddlyWiki
Sorry, just realized that you talking about "wikify" widget, not "macrocall"! :(

TonyM

unread,
Nov 28, 2018, 3:51:58 AM11/28/18
to TiddlyWiki
The way I understand the use of $name in the macrocall widget is macrocall is designed to be able to call any macro and thus its own parameters must not clash with any parameter in any macro. Thus the $ is used or you could not use the parameter name=.

Regards
Tony

bimlas

unread,
Nov 28, 2018, 4:36:51 AM11/28/18
to TiddlyWiki
Yes, you are right.
Reply all
Reply to author
Forward
0 new messages