Compare commits
No commits in common. "6c6cec62988d5d9ca48d3a23843393ca613a567b" and "0936963aaf8f9bbd367714c2dd7ce3a62ed6138c" have entirely different histories.
6c6cec6298
...
0936963aaf
@ -23,7 +23,7 @@
|
|||||||
{{ if .Container }}
|
{{ if .Container }}
|
||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h2><a href="container?id={{ .Container.Id }}">{{ .Container.Id }}</a>
|
<h2>{{ .Container.Id }}
|
||||||
{{- range .Container.Path }}
|
{{- range .Container.Path }}
|
||||||
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
<small>« <a href="container?id={{ . }}">{{ . }}</a></small>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"html"
|
|
||||||
"html/template"
|
"html/template"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
@ -12,7 +11,6 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"regexp"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@ -357,19 +355,6 @@ var funcMap = template.FuncMap{
|
|||||||
"lines": func(s string) int {
|
"lines": func(s string) int {
|
||||||
return strings.Count(s, "\n") + 1
|
return strings.Count(s, "\n") + 1
|
||||||
},
|
},
|
||||||
"highlight": func(highlight, s string) template.HTML {
|
|
||||||
b, last := strings.Builder{}, 0
|
|
||||||
for _, m := range regexp.MustCompile(
|
|
||||||
`(?i:`+regexp.QuoteMeta(highlight)+`)`).FindAllStringIndex(s, -1) {
|
|
||||||
b.WriteString(html.EscapeString(s[last:m[0]]))
|
|
||||||
b.WriteString(`<mark>`)
|
|
||||||
b.WriteString(html.EscapeString(s[m[0]:m[1]]))
|
|
||||||
b.WriteString(`</mark>`)
|
|
||||||
last = m[1]
|
|
||||||
}
|
|
||||||
b.WriteString(html.EscapeString(s[last:]))
|
|
||||||
return template.HTML(b.String())
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<section>
|
<section>
|
||||||
<header>
|
<header>
|
||||||
<h3><a href="series?prefix={{ .Prefix }}">{{ .Prefix }}</a></h3>
|
<h3><a href="series?prefix={{ .Prefix }}">{{ .Prefix }}</a></h3>
|
||||||
<p>{{ .Description | highlight $.Query }}
|
<p>{{ .Description }}
|
||||||
</header>
|
</header>
|
||||||
</section>
|
</section>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
@ -28,7 +28,7 @@
|
|||||||
</h3>
|
</h3>
|
||||||
</header>
|
</header>
|
||||||
{{- if .Description }}
|
{{- if .Description }}
|
||||||
<p>{{ .Description | highlight $.Query }}
|
<p>{{ .Description }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</section>
|
</section>
|
||||||
{{ else }}
|
{{ else }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user