import urllib.parse
from typing import Iterable
from reader import EntrySearchResult, HighlightedString
from discord_rss_bot.settings import reader
def create_html_for_search_results(search_results: Iterable[EntrySearchResult]) -> str:
"""Create HTML for the search results.
Args:
search_results: The search results.
Returns:
str: The HTML.
"""
html = ""
for result in search_results:
if ".summary" in result.content:
result_summary = add_span_with_slice(result.content[".summary"])
feed = reader.get_feed(result.feed_url)
feed_url = urllib.parse.quote(feed.url)
html += f"""
{result.metadata[".title"]}
{result_summary}