Documentation
¶
Overview ¶
Package fields holds the small normalization helpers that source connectors share. Each helper has at least two connector call sites.
Index ¶
- Variables
- func CompactSpace(value string) string
- func DOIURL(doi string) string
- func FirstNonEmpty(values ...string) string
- func JSONScalarString(raw json.RawMessage) string
- func NonEmptyStrings(values ...string) []string
- func NormalizeArXivID(value string) string
- func NormalizeDOI(value string) string
- func StripHTMLTags(s string) string
Constants ¶
This section is empty.
Variables ¶
var HTMLTagRe = htmlTagRe
HTMLTagRe matches HTML tags. Connectors that need custom replacement text use it directly; otherwise use StripHTMLTags.
Functions ¶
func CompactSpace ¶
CompactSpace collapses runs of whitespace into one space.
func FirstNonEmpty ¶
FirstNonEmpty returns the first value that is not blank.
func JSONScalarString ¶
func JSONScalarString(raw json.RawMessage) string
JSONScalarString decodes a JSON string or number into a trimmed string.
func NonEmptyStrings ¶
NonEmptyStrings returns the trimmed values that are not empty.
func NormalizeArXivID ¶
NormalizeArXivID trims whitespace, an abs URL prefix and a version suffix.
func NormalizeDOI ¶
NormalizeDOI lowercases a DOI and removes a URL or "doi:" prefix.
func StripHTMLTags ¶
StripHTMLTags removes HTML tags from s and collapses whitespace.
Types ¶
This section is empty.