Fill in html tag generation
This commit is contained in:
parent
3d4ca5fd4c
commit
feaa5fc2de
1 changed files with 9 additions and 4 deletions
|
@ -3,6 +3,7 @@ using System.Collections.Concurrent;
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using UnidecodeSharpFork;
|
||||
|
@ -228,10 +229,14 @@ namespace LibSearchBox
|
|||
|
||||
if (settings.Html) {
|
||||
result = WebUtility.HtmlEncode(result);
|
||||
string resultSearchable = result.Unidecode().ToLower();
|
||||
|
||||
foreach((int, string) nextToken in tokenizer.IterateTokens()) {
|
||||
// TODO: Insert html tags here
|
||||
throw new NotImplementedException("HTML tag insertion hasn't been implemented yet");
|
||||
result = Regex.Replace(
|
||||
result,
|
||||
Regex.Escape(nextToken.Item2),
|
||||
$"<strong class='query-term'>{nextToken.Item2}</strong>",
|
||||
RegexOptions.IgnoreCase // Also ignores accents, apparently
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue