mirror of
https://github.com/makew0rld/amfora.git
synced 2024-08-15 08:50:52 +03:00
remove redundant bool
This commit is contained in:
parent
88caea0808
commit
575476857a
@ -184,7 +184,6 @@ func Init(version, commit, builtBy string) {
|
|||||||
text := make([]byte, 0)
|
text := make([]byte, 0)
|
||||||
matches = 0
|
matches = 0
|
||||||
lastMatch := 0
|
lastMatch := 0
|
||||||
var isMatch bool
|
|
||||||
|
|
||||||
// loops through all occurrences and check if they
|
// loops through all occurrences and check if they
|
||||||
// discard if they lie within tags.
|
// discard if they lie within tags.
|
||||||
@ -192,21 +191,17 @@ func Init(version, commit, builtBy string) {
|
|||||||
// with the actual search strings replaced by tagged regions
|
// with the actual search strings replaced by tagged regions
|
||||||
// to highlight.
|
// to highlight.
|
||||||
for i, match := range searchIdx {
|
for i, match := range searchIdx {
|
||||||
isMatch = true
|
|
||||||
for _, tag := range tagsIdx {
|
for _, tag := range tagsIdx {
|
||||||
if match[0] >= tag[0] && match[1] <= tag[1] {
|
if match[0] >= tag[0] && match[1] <= tag[1] {
|
||||||
isMatch = false
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if isMatch {
|
matches++
|
||||||
matches++
|
text = append(text, originalText[lastMatch:match[0]]...)
|
||||||
text = append(text, originalText[lastMatch:match[0]]...)
|
replacement := []byte(fmt.Sprint(`["search-`, i, `"]`, searchString, `[""]`))
|
||||||
replacement := []byte(fmt.Sprint(`["search-`, i, `"]`, searchString, `[""]`))
|
text = append(text, replacement...)
|
||||||
text = append(text, replacement...)
|
lastMatch = match[0] + len(searchString)
|
||||||
lastMatch = match[0] + len(searchString)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
text = append(text, originalText[lastMatch:]...)
|
text = append(text, originalText[lastMatch:]...)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user