Documentation
¶
Overview ¶
Package doiutils provides a set of functions to work with DOIs
Index ¶
- func DOIResolver(doi string, sandbox bool) string
- func DecodeDOI(doi string) int64
- func EncodeDOI(prefix string) string
- func EscapeDOI(doi string) string
- func GetDOIRA(doi string) (string, bool)
- func IsRegisteredDOI(doi string) bool
- func IsRogueScholarDOI(doi string, ra string) bool
- func NormalizeDOI(doi string) string
- func PrefixFromUrl(str string) (string, error)
- func ValidateDOI(doi string) (string, bool)
- func ValidatePrefix(doi string) (string, bool)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DOIResolver ¶
DOIResolver returns a DOI resolver for a given DOI
func DecodeDOI ¶ added in v0.6.28
Example ¶
package main import ( "fmt" "github.com/front-matter/commonmeta/doiutils" ) func main() { i := doiutils.DecodeDOI("https://doi.org/10.59350/v2gec-5xt36") fmt.Println(i) }
Output: 930412369850
func EncodeDOI ¶ added in v0.6.28
Example ¶
package main import ( "fmt" "regexp" "github.com/front-matter/commonmeta/doiutils" ) func main() { s := doiutils.EncodeDOI("10.73731") r := regexp.MustCompile(`^https://doi.org/10.73731/(.+)$`) fmt.Println(r.MatchString(s)) }
Output: true
func EscapeDOI ¶ added in v0.5.27
EscapeDOI escapes a DOI, i.e. replaces '/' with '%2F'
Example ¶
package main import ( "fmt" "github.com/front-matter/commonmeta/doiutils" ) func main() { s := doiutils.EscapeDOI("10.59350/k0746-rsc44") fmt.Println(s) }
Output: 10.59350%2Fk0746-rsc44
func IsRegisteredDOI ¶ added in v0.6.28
IsRegisteredDOI checks if a DOI resolves (i.e. redirects) via the DOI handle servers
func IsRogueScholarDOI ¶ added in v0.2.14
IsRogueScholarDOI checks if a DOI is from Rogue Scholar
func PrefixFromUrl ¶
PrefixFromUrl extracts DOI prefix from URL
func ValidatePrefix ¶
ValidatePrefix validates a DOI prefix for a given DOI
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.