HI Eric:

>From your latest email I've incorporated the number of times targetString 
was matched and the div for the showOutput.
I've also echoed the input parameters to formatTid.highlightText and added 
a "pane" format for the target string.

Thanks to your help it keeps getting better and better.
Here is a screen shot of the results.

Thanks again
Steve




\define formatTid.highlightText(source:"MainMenu" targetString:"Handler" 
highlightColor:"blue" 
highlightStyle:"background-color:khaki;color:#656565;font-size:8.5pt;font-weight:bold;border-radius:
 
2px;border-style:solid;border-color:gray;border-width:1px;")

<$set name="outputText" filter=
"[{$source$}splitregexp[$targetString$]join[@@$highlightStyle$$targetString$@@]]"
 
select="0">


|''For source'': @@color:navy;font-size:8pt;font-weight:bold;$source$@@; ''
targetString'': @@color:navy;font-size:8pt;font-weight:bold;$targetString$@@
; ''found'' @@color:navy;font-size:8pt;font-weight:bold;<$text text={{{ [{
$source$}splitregexp[$targetString$]count[]subtract[1]] }}} /> match(es).@@|

<div style="border:1px solid;white-space:pre-wrap;font-family:monospace;">

<<showOutput>>
</div>

\end
\define showOutput()
\rules only styleinline
$(outputText)$
\end
\define formatTid.highlightText.ui()
<!-- User interface to:
        * enter target string
        * select source
        * display formatTid.highlightText results in table
-->

---

<!-- Type string into entryBuffer and press GO to
         * copy string from entryBuffer to targetString (avoids responding 
to each keystroke)
         * initialize source to (avoid retaining prev choice if no matching 
tiddlers were found)
-->
''Enter targetString and press GO'' <$edit-text tiddler="$:/temp/highlight/
entryBuffer" tag="input" default="" placeholder="enter text to highlight" />
<$button><$action-setfield $tiddler="$:/temp/highlight/targetString" 
 $value={{$:/temp/highlight/entryBuffer}}/><$action-setfield $tiddler="$:
/temp/highlight/source"  $value=""/>GO</$button>
<$vars targetString={{$:/temp/highlight/targetString}}><br>

<!-- Select source tiddler from tids that contain
        the search string (if any)
-->
''Select Source (tiddler)'' 
@@color:navy;font-variant:super;font-weight:bold;(<$count filter="[!is[
system]search:text<targetString>has[code-library]]"/> found)@@ <$select 
tiddler="$:/temp/highlight/source" default="blurg">
<$list 
filter="[!is[system]search:text<targetString>has[code-library]sort[]]"><option 
value=<<currentTiddler>>><$text text=<<currentTiddler>>/></option></$list>
</$select><br>

<!-- Highlight targetString's in the selected source tid.
-->
<$reveal text={{$:/temp/highlight/source}}  type="nomatch" default="">
<$macrocall $name="formatTid.highlightText" 
source={{$:/temp/highlight/source}} targetString=<<targetString>>/>
</$reveal>
</$vars>

---
\end
<<formatTid.highlightText.ui>>


-- 
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/43d692c8-88ae-4c77-acc7-a5e5ecba53d4o%40googlegroups.com.

Reply via email to