From 4e3875c0ce7f3b17e3d358dc5ecb1f8bed64546b Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Mon, 12 Oct 2020 11:35:55 +0200 Subject: 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 --- tpl/default/linklist.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tpl') 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 @@ {/if} - {$value.title} + {$value.title_html} @@ -183,7 +183,7 @@ {$tag_counter=count($value.taglist)} {loop="value.taglist"} - {$value} + {$value1.taglist_html.$key2} {if="$tag_counter - 1 != $counter"}·{/if} {/loop} @@ -251,7 +251,7 @@ {ignore}do not add space or line break between these div - Firefox issue{/ignore} class="linklist-item-infos-url pure-u-lg-5-12 pure-u-1"> - {$value.url} + {$value.url_html}