\define mc() This is a `code` and __underline__.
<$wikify name="result" text="""<<mc>>""">
<<result>>
</$wikify>This is a code and underline.code and underline.\define mc() This is a `code` and __underline__.
<$wikify name="result" text="""<<mc>>""" output=html>
<<result>>
</$wikify>code and underline.\define mc() This is a `code` and __underline__.
<$wikify name="result" text="""<<mc>>""" output=html>
<<result>>
<$button>do
<$action-setfield $tiddler="hodii" $field="text" $value=<<result>> />
</$button>
</$wikify><$action-setfield $tiddler="hodii" $field="text" $value=<<mc>> />BTC,I am still struggling with search-n-replace with no success! (also split[]joing[] failed)I even tried to use JavaScript replace macro (while I really want to stick to TW script) it simply receives the tiddler text fieldsearchValue and replcaeValue, but amazingly it removes some of formatting!So, these questions raised from trial and error with TW scripts to see how can I figure out this, using Tiddlywiki widgets, filters, operators...Any light you can shed to this case is highly appreciated!
The problem is writing back to the tiddler, where it loses some formatting!Also, it cannot distinguish the whole words like change "is" to "was" in
\define snr(source:"", searchValue:"", replaceValue:"")
\whitespace trim
<$vars
src =<<__source__>>
sval =<<__searchValue__>>
rval =<<__replaceValue__>>
>
<$list filter="[<src>search<sval>]" emptyMessage="""<$text text=<<src>> />""" >
<$list variable="p1" filter="[<src>splitbefore<sval>]">
<$list variable="p2" filter="[<src>removeprefix<p1>]">
<$list variable="p3" filter="[<p1>removesuffix<sval>addsuffix<rval>]" emptyMessage="""<$text text=<<src>>/>""">
<$text text=<<p3>>/>
<$macrocall $name="snr"
source=<<p2>>
searchValue=<<sval>>
replaceValue=<<rval>>
/>
</$list>
</$list>
</$list>
</$list>
</$vars>
\end
<<replace-text-ui>>BTC,One more question, is it possible to add
- case-INsensitive search-n-replace
- Whole words search-n-replace