mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-24 16:16:35 -05:00
parent
00d08473b8
commit
d644e88107
1 changed files with 5 additions and 4 deletions
|
@ -6,6 +6,7 @@ package search
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"html"
|
||||||
gotemplate "html/template"
|
gotemplate "html/template"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -75,17 +76,17 @@ func searchResult(result *indexer.RepoSearchResult, startIndex, endIndex int) (*
|
||||||
closeActiveIndex := util.Min(result.EndIndex-index, len(line))
|
closeActiveIndex := util.Min(result.EndIndex-index, len(line))
|
||||||
err = writeStrings(&formattedLinesBuffer,
|
err = writeStrings(&formattedLinesBuffer,
|
||||||
`<li>`,
|
`<li>`,
|
||||||
line[:openActiveIndex],
|
html.EscapeString(line[:openActiveIndex]),
|
||||||
`<span class='active'>`,
|
`<span class='active'>`,
|
||||||
line[openActiveIndex:closeActiveIndex],
|
html.EscapeString(line[openActiveIndex:closeActiveIndex]),
|
||||||
`</span>`,
|
`</span>`,
|
||||||
line[closeActiveIndex:],
|
html.EscapeString(line[closeActiveIndex:]),
|
||||||
`</li>`,
|
`</li>`,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
err = writeStrings(&formattedLinesBuffer,
|
err = writeStrings(&formattedLinesBuffer,
|
||||||
`<li>`,
|
`<li>`,
|
||||||
line,
|
html.EscapeString(line),
|
||||||
`</li>`,
|
`</li>`,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue