diff options
Diffstat (limited to 'skate/cleanup.go')
-rw-r--r-- | skate/cleanup.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/skate/cleanup.go b/skate/cleanup.go index b50e048..c8ce6d1 100644 --- a/skate/cleanup.go +++ b/skate/cleanup.go @@ -5,6 +5,7 @@ import ( "log" "strings" + "github.com/segmentio/encoding/json" "mvdan.cc/xurls/v2" ) @@ -76,3 +77,16 @@ func (f *FilterDOI) Run(p []byte) ([]byte, error) { parts[f.Index-1] = strings.ToLower(doi) return []byte(strings.Join(parts, f.Delimiter)), nil } + +type FilterRawRef struct{} + +func (f *FilterRawRef) Run(p []byte) ([]byte, error) { + var ref Ref + if err := json.Unmarshal(p, &ref); err != nil { + return nil, err + } + if strings.Contains(ref.Biblio.Unstructured, "................") { + return nil, nil + } + return p, nil +} |