Fixed errors in merge

This commit is contained in:
squidfunk
2020-09-27 09:47:23 +02:00
parent 8f61fd3b56
commit 5be0004bcc
8 changed files with 9 additions and 33 deletions

View File

@@ -75,22 +75,13 @@ function renderArticleDocument(
{ location, title, text, terms, score }: SearchDocument & SearchMetadata,
teaser: boolean
) {
const highlight: string[] = []
for (const [value, found] of Object.entries(terms))
if (found)
highlight.push(value)
const url = new URL(location)
url.searchParams.append("h", highlight.join(" "))
const miss = Object.keys(terms)
// tslint:disable-next-line: array-type
.reduce<Array<Element | string>>((list, key) => [
...list, ...!terms[key] ? [<del>{key}</del>, " "] : []
], [])
return (
<a href={url.toString().replace(/%20/g, "+")} class={css.link} tabIndex={-1}>
<a href={location.toString().replace(/%20/g, "+")} class={css.link} tabIndex={-1}>
<article class={css.article} data-md-score={score.toFixed(2)}>
<div class="md-search-result__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
@@ -121,22 +112,13 @@ function renderArticleDocument(
function renderSection(
{ location, title, text, terms, score }: SearchDocument & SearchMetadata
) {
const highlight: string[] = []
for (const [value, found] of Object.entries(terms))
if (found)
highlight.push(value)
const url = new URL(location)
url.searchParams.append("h", highlight.join(" "))
const miss = Object.keys(terms)
// tslint:disable-next-line: array-type
.reduce<Array<Element | string>>((list, key) => [
...list, ...!terms[key] ? [<del>{key}</del>, " "] : []
], [])
return (
<a href={url.toString().replace(/%20/g, "+")} class={css.link} tabIndex={-1}>
<a href={location.toString().replace(/%20/g, "+")} class={css.link} tabIndex={-1}>
<article class={css.section} data-md-score={score.toFixed(2)}>
<h1 class={css.title}>{title}</h1>
{text.length > 0 &&