aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-10-12 11:35:55 +0200
committerArthurHoaro <arthur@hoa.ro>2020-10-16 20:31:12 +0200
commit4e3875c0ce7f3b17e3d358dc5ecb1f8bed64546b (patch)
tree4deb157f03ce7d5402dbfeb65743951d97e527cf /tpl
parent64cac2562661c55f679dba5a7c308e7764f430b5 (diff)
downloadShaarli-4e3875c0ce7f3b17e3d358dc5ecb1f8bed64546b.tar.gz
Shaarli-4e3875c0ce7f3b17e3d358dc5ecb1f8bed64546b.tar.zst
Shaarli-4e3875c0ce7f3b17e3d358dc5ecb1f8bed64546b.zip
Feature: highlight fulltext search results
How it works: 1. when a fulltext search is made, Shaarli looks for the first occurence position of every term matching the search. No change here, but we store these positions in an array, in Bookmark's additionalContent. 2. when formatting bookmarks (through BookmarkFormatter implementation): 1. first we insert specific tokens at every search result positions 2. we format the content (escape HTML, apply markdown, etc.) 3. as a last step, we replace our token with displayable span elements Cons: this tightens coupling between search filters and formatters Pros: it was absolutely necessary not to perform the search twice. this solution has close to no impact on performances. Fixes #205
Diffstat (limited to 'tpl')
-rw-r--r--tpl/default/linklist.html6
1 files changed, 3 insertions, 3 deletions
diff --git a/tpl/default/linklist.html b/tpl/default/linklist.html
index e1fb54dd..beab0eac 100644
--- a/tpl/default/linklist.html
+++ b/tpl/default/linklist.html
@@ -165,7 +165,7 @@
165 <i class="fa fa-sticky-note" aria-hidden="true"></i> 165 <i class="fa fa-sticky-note" aria-hidden="true"></i>
166 {/if} 166 {/if}
167 167
168 <span class="linklist-link">{$value.title}</span> 168 <span class="linklist-link">{$value.title_html}</span>
169 </a> 169 </a>
170 </h2> 170 </h2>
171 </div> 171 </div>
@@ -183,7 +183,7 @@
183 {$tag_counter=count($value.taglist)} 183 {$tag_counter=count($value.taglist)}
184 {loop="value.taglist"} 184 {loop="value.taglist"}
185 <span class="label label-tag" title="{$strAddTag}"> 185 <span class="label label-tag" title="{$strAddTag}">
186 <a href="{$base_path}/add-tag/{$value1.urlencoded_taglist.$key2}">{$value}</a> 186 <a href="{$base_path}/add-tag/{$value1.taglist_urlencoded.$key2}">{$value1.taglist_html.$key2}</a>
187 </span> 187 </span>
188 {if="$tag_counter - 1 != $counter"}&middot;{/if} 188 {if="$tag_counter - 1 != $counter"}&middot;{/if}
189 {/loop} 189 {/loop}
@@ -251,7 +251,7 @@
251 {ignore}do not add space or line break between these div - Firefox issue{/ignore} 251 {ignore}do not add space or line break between these div - Firefox issue{/ignore}
252 class="linklist-item-infos-url pure-u-lg-5-12 pure-u-1"> 252 class="linklist-item-infos-url pure-u-lg-5-12 pure-u-1">
253 <a href="{$value.real_url}" aria-label="{$value.title}" title="{$value.title}"> 253 <a href="{$value.real_url}" aria-label="{$value.title}" title="{$value.title}">
254 <i class="fa fa-link" aria-hidden="true"></i> {$value.url} 254 <i class="fa fa-link" aria-hidden="true"></i> {$value.url_html}
255 </a> 255 </a>
256 <div class="linklist-item-buttons pure-u-0 pure-u-lg-visible"> 256 <div class="linklist-item-buttons pure-u-0 pure-u-lg-visible">
257 <a href="#" aria-label="{$strFold}" title="{$strFold}" class="fold-button"><i class="fa fa-chevron-up" aria-hidden="true"></i></a> 257 <a href="#" aria-label="{$strFold}" title="{$strFold}" class="fold-button"><i class="fa fa-chevron-up" aria-hidden="true"></i></a>