diff options
Diffstat (limited to 'skate/cleanup.go')
-rw-r--r-- | skate/cleanup.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/skate/cleanup.go b/skate/cleanup.go index c8ce6d1..4a10063 100644 --- a/skate/cleanup.go +++ b/skate/cleanup.go @@ -9,6 +9,8 @@ import ( "mvdan.cc/xurls/v2" ) +// TODO: This should be revisited entirely. + var rxRelaxed = xurls.Relaxed() // URLFilter is a line oriented URL filter. @@ -21,6 +23,7 @@ type FilterURL struct { AllowedSchemas []string } +// Run executes the filter on a blob of data, most likely a line. func (f *FilterURL) Run(p []byte) ([]byte, error) { parts := strings.Split(string(p), f.Delimiter) if len(parts) < f.Index { @@ -59,6 +62,7 @@ type FilterDOI struct { AllowedSchema []string } +// Run executes the filter on a blob of data, most likely a line. func (f *FilterDOI) Run(p []byte) ([]byte, error) { parts := strings.Split(string(p), f.Delimiter) if len(parts) < f.Index { @@ -78,8 +82,11 @@ func (f *FilterDOI) Run(p []byte) ([]byte, error) { return []byte(strings.Join(parts, f.Delimiter)), nil } +// FilterRawRef is an ad-hoc filter. type FilterRawRef struct{} +// Run executes the filter. TODO: Gather cleanup functions together and make +// them more easily shared. func (f *FilterRawRef) Run(p []byte) ([]byte, error) { var ref Ref if err := json.Unmarshal(p, &ref); err != nil { |