Get rid of unused functions
This commit is contained in:
parent
57db4178d0
commit
a7a6b5c711
37
atom.go
37
atom.go
@ -11,10 +11,6 @@ import (
|
|||||||
"golang.org/x/text/language"
|
"golang.org/x/text/language"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Unescape(s string) string {
|
|
||||||
return html.UnescapeString(s)
|
|
||||||
}
|
|
||||||
|
|
||||||
// isValidIRI checks whether an IRI is valid or not. It returns a bool.
|
// isValidIRI checks whether an IRI is valid or not. It returns a bool.
|
||||||
// https://www.w3.org/2011/04/XMLSchema/TypeLibrary-IRI-RFC3987.xsd
|
// https://www.w3.org/2011/04/XMLSchema/TypeLibrary-IRI-RFC3987.xsd
|
||||||
func isValidIRI(iri string) bool {
|
func isValidIRI(iri string) bool {
|
||||||
@ -22,15 +18,6 @@ func isValidIRI(iri string) bool {
|
|||||||
return regexp.MustCompile(pattern).MatchString(iri)
|
return regexp.MustCompile(pattern).MatchString(iri)
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewIRI creates a new IRI. It returns a string and an error.
|
|
||||||
func NewIRI(iri string) (string, error) {
|
|
||||||
if !isValidIRI(iri) {
|
|
||||||
return "", fmt.Errorf("iri %v not correctly formatted", iri)
|
|
||||||
}
|
|
||||||
|
|
||||||
return iri, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// isCorrectlyEscaped checks whether a string is correctly escaped as per
|
// isCorrectlyEscaped checks whether a string is correctly escaped as per
|
||||||
// RFC4287. It returns a bool.
|
// RFC4287. It returns a bool.
|
||||||
func isCorrectlyEscaped(text string) bool {
|
func isCorrectlyEscaped(text string) bool {
|
||||||
@ -83,31 +70,12 @@ func isValidMediaType(m string) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewMediaType creates a new MediaType. It returns a string and an error.
|
|
||||||
func NewMediaType(m string) (string, error) {
|
|
||||||
if !isValidMediaType(m) {
|
|
||||||
return "", fmt.Errorf("media type %v invalid", m)
|
|
||||||
}
|
|
||||||
|
|
||||||
mediaType, _, _ := mime.ParseMediaType(m)
|
|
||||||
return mediaType, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// isValidLanguageTag checks whether a LanguageTag is valid. It returns a bool.
|
// isValidLanguageTag checks whether a LanguageTag is valid. It returns a bool.
|
||||||
func isValidLanguageTag(languageTag string) bool {
|
func isValidLanguageTag(languageTag string) bool {
|
||||||
_, err := language.Parse(languageTag)
|
_, err := language.Parse(languageTag)
|
||||||
return err == nil
|
return err == nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLanguageTag creates a new LanguageTag. It returns a string and an error.
|
|
||||||
func NewLanguageTag(l string) (string, error) {
|
|
||||||
if !isValidLanguageTag(l) {
|
|
||||||
return "", fmt.Errorf("language tag %v invalid", l)
|
|
||||||
}
|
|
||||||
|
|
||||||
return l, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// isValidAttribute checks whether an Attribute is valid. It returns a bool.
|
// isValidAttribute checks whether an Attribute is valid. It returns a bool.
|
||||||
func isValidAttribute(attribute string) bool {
|
func isValidAttribute(attribute string) bool {
|
||||||
regex := regexp.MustCompile(`^[a-zA-Z0-9_]+="[^"]*"$`)
|
regex := regexp.MustCompile(`^[a-zA-Z0-9_]+="[^"]*"$`)
|
||||||
@ -118,3 +86,8 @@ func isValidAttribute(attribute string) bool {
|
|||||||
func NewURN() string {
|
func NewURN() string {
|
||||||
return fmt.Sprint("urn:uuid:", uuid.New())
|
return fmt.Sprint("urn:uuid:", uuid.New())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Unescape unescapes a string. It returns an IRI.
|
||||||
|
func Unescape(s string) string {
|
||||||
|
return html.UnescapeString(s)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user