blob: 4f5b50de9d174fe4f0fb84f370f10e97bd5119f7 [file] [log] [blame]
// Copyright 2020 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package dochtml
import (
"regexp"
"golang.org/x/pkgsite/internal/godoc/internal/doc"
)
// "Deprecated:" at the start of a paragraph.
var deprecatedRx = regexp.MustCompile(`(^|\n\s*\n)\s*Deprecated:`)
// isDeprecated reports whether the string has a "Deprecated" line.
func isDeprecated(s string) bool {
return deprecatedRx.MatchString(s)
}
func typeIsDeprecated(t *doc.Type) bool {
return isDeprecated(t.Doc)
}
func valueIsDeprecated(v *doc.Value) bool {
return isDeprecated(v.Doc)
}
func funcIsDeprecated(f *doc.Func) bool {
return isDeprecated(f.Doc)
}