Fill in html tag generation

This commit is contained in:
Starbeamrainbowlabs 2018-09-25 20:25:05 +01:00
parent 3d4ca5fd4c
commit feaa5fc2de
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
1 changed files with 9 additions and 4 deletions

View File

@ -3,6 +3,7 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using UnidecodeSharpFork; using UnidecodeSharpFork;
@ -228,10 +229,14 @@ namespace LibSearchBox
if (settings.Html) { if (settings.Html) {
result = WebUtility.HtmlEncode(result); result = WebUtility.HtmlEncode(result);
string resultSearchable = result.Unidecode().ToLower();
foreach ((int, string) nextToken in tokenizer.IterateTokens()) { foreach((int, string) nextToken in tokenizer.IterateTokens()) {
// TODO: Insert html tags here result = Regex.Replace(
throw new NotImplementedException("HTML tag insertion hasn't been implemented yet"); result,
Regex.Escape(nextToken.Item2),
$"<strong class='query-term'>{nextToken.Item2}</strong>",
RegexOptions.IgnoreCase // Also ignores accents, apparently
);
} }
} }