2020-03-11 16:55:19 +00:00
title: $:/plugins/tiddlywiki/dynannotate/examples/simple
tags: $:/tags/dynannotateExamples
caption: Simple
\define show-example(example)
<$codeblock code=<<__example__>>/>
//''Displays as:''//
$example$
\end
2023-05-06 10:30:21 +00:00
\define search-example-code()
<!--
The inline filters update the displayed codeblock to reflect the choices the user has made in the UI.
The rules pragma is used here to evaluate only these filters, but leave everything else untouched.
The tabs and linebreaks within the parameters to addprefix, though maybe confusing, help with the readability of the codeblock output.
-->
\rules only filteredtranscludeinline
2020-03-11 16:55:19 +00:00
<$dynannotate
2023-05-06 10:30:21 +00:00
search="{{{ [{$:/temp/dynannotate-example/search}!is[blank]else[The human mind]] }}}"{{{ [{$:/temp/dynannotate-example/searchMode}!search::some[literal normal]addprefix[
searchMode="]addsuffix["]] }}}
searchCaseSensitive="{{{ [{$:/temp/dynannotate-example/searchCaseSensitive}!is[blank]else[yes]] }}}"{{{ [{$:/temp/dynannotate-example/searchClass}!is[blank]addprefix[
searchClass="]addsuffix["]] }}}
2020-03-11 16:55:19 +00:00
>
<$transclude tiddler="$:/plugins/tiddlywiki/dynannotate/example-text-1" mode="block"/>
2023-05-06 10:30:21 +00:00
<$transclude tiddler="$:/plugins/tiddlywiki/dynannotate/example-text-2" mode="block"/>
2020-03-11 16:55:19 +00:00
</$dynannotate>
2023-05-06 10:30:21 +00:00
\end
2020-03-11 16:55:19 +00:00
<div class="tc-dynannotation-example-info">
2023-05-06 10:30:21 +00:00
!! Annotations with `target`
2020-03-11 16:55:19 +00:00
2023-05-06 10:30:21 +00:00
We use the `target*` attributes to specify a target string for the annotation and optionally a prefix and suffix for disambiguating multiple occurences.
2020-03-11 16:55:19 +00:00
</div>
2023-05-06 10:30:21 +00:00
<<show-example """<$dynannotate
target="the"
targetPrefix="Yet "
targetSuffix=" speed"
2020-03-11 16:55:19 +00:00
>
<$transclude tiddler="$:/plugins/tiddlywiki/dynannotate/example-text-1" mode="block"/>
</$dynannotate>
""">>
<div class="tc-dynannotation-example-info">
2023-05-06 10:30:21 +00:00
!! Highlights with `search`
2020-03-11 16:55:19 +00:00
2023-05-06 10:30:21 +00:00
We use the `search` attribute to specify a search string for highlighting.
2020-03-11 16:55:19 +00:00
2023-05-06 10:30:21 +00:00
The search type can be set with the `searchMode` and `searchCaseSensitive` attributes.
2020-03-11 16:55:19 +00:00
2023-05-06 10:30:21 +00:00
We can style the highlights with the `searchClass` attribute, which has some predefined values.
2020-03-11 16:55:19 +00:00
</div>
2023-05-06 10:30:21 +00:00
|tc-table-no-border tc-dynannotate-search-parameters|k
|search term |<$edit-text tiddler="$:/temp/dynannotate-example/search" field="text" tag="input" default="The human mind" />|
|search mode |<$select tiddler="$:/temp/dynannotate-example/searchMode" field="text" default="literal"><option value="literal">literal</option><option value="normal">normal</option><option value="regexp">regexp</option><option value="whitespace">whitespace</option><option value="some">some</option><option value="words">words</option></$select> |
|case sensitive |<$checkbox tiddler="$:/temp/dynannotate-example/searchCaseSensitive" field="text" checked="yes" unchecked="no" default="yes"> <$text text={{{ [{$:/temp/dynannotate-example/searchCaseSensitive}!is[blank]else[yes]] }}} /></$checkbox> |
|search class |<$select tiddler="$:/temp/dynannotate-example/searchClass" field="text" default=""><option value="">(none)</option><option value="tc-dynannotation-search-overlay-animated">tc-dynannotation-search-overlay-animated</option><option value="tc-dynannotation-search-overlay-blurred">tc-dynannotation-search-overlay-blurred</option></$select> |
2020-03-11 16:55:19 +00:00
<$dynannotate
2023-05-06 10:30:21 +00:00
search={{{ [{$:/temp/dynannotate-example/search}!is[blank]else[The human mind]] }}}
searchMode={{{ [{$:/temp/dynannotate-example/searchMode}] }}}
searchCaseSensitive={{{ [{$:/temp/dynannotate-example/searchCaseSensitive}!is[blank]else[yes]] }}}
searchClass={{{ [{$:/temp/dynannotate-example/searchClass}] }}}
2020-03-11 16:55:19 +00:00
>
<$transclude tiddler="$:/plugins/tiddlywiki/dynannotate/example-text-1" mode="block"/>
2023-05-06 10:30:21 +00:00
<$transclude tiddler="$:/plugins/tiddlywiki/dynannotate/example-text-2" mode="block"/>
2020-03-11 16:55:19 +00:00
</$dynannotate>
2023-05-06 10:30:21 +00:00
<$wikify name="wikifiedCode" text=<<search-example-code>> mode="block" output="text">
<$codeblock code=<<wikifiedCode>>/>
</$wikify>
2020-03-11 16:55:19 +00:00
<div class="tc-dynannotation-example-info">
!! Using annotation tiddlers
Annotation tiddlers can be used to describe annotations. This example references the following annotation tiddlers:
</div>
<<list-links "[all[shadows+tiddlers]annotate-tiddler[$:/plugins/tiddlywiki/dynannotate/example-text-1]]">>
2023-05-06 10:30:21 +00:00
<<show-example """<$dynannotate
2020-03-11 16:55:19 +00:00
filter="[all[shadows+tiddlers]annotate-tiddler[$:/plugins/tiddlywiki/dynannotate/example-text-1]]"
>
<$transclude tiddler="$:/plugins/tiddlywiki/dynannotate/example-text-1" mode="block"/>
</$dynannotate>
""">>