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

View file

@ -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
);
}
}