Documentation
¶
Index ¶
- type AbsoluteURL
- func (u AbsoluteURL) Equivalent(url URL) bool
- func (u AbsoluteURL) Extension() string
- func (u AbsoluteURL) Filename() string
- func (u AbsoluteURL) Fragment() string
- func (u AbsoluteURL) IsFile() bool
- func (u AbsoluteURL) IsHTTP() bool
- func (u AbsoluteURL) Normalize() URL
- func (u AbsoluteURL) Path() string
- func (u AbsoluteURL) Raw() *gurl.URL
- func (u AbsoluteURL) Relativize(url URL) URL
- func (u AbsoluteURL) RemoveFragment() URL
- func (u AbsoluteURL) RemoveQuery() URL
- func (u AbsoluteURL) Resolve(url URL) URL
- func (u AbsoluteURL) Scheme() Scheme
- func (u AbsoluteURL) String() string
- func (u AbsoluteURL) ToFilepath() string
- type RelativeURL
- func (u RelativeURL) Equivalent(url URL) bool
- func (u RelativeURL) Extension() string
- func (u RelativeURL) Filename() string
- func (u RelativeURL) Fragment() string
- func (u RelativeURL) Normalize() URL
- func (u RelativeURL) Path() string
- func (u RelativeURL) Raw() *gurl.URL
- func (u RelativeURL) Relativize(url URL) URL
- func (u RelativeURL) RemoveFragment() URL
- func (u RelativeURL) RemoveQuery() URL
- func (u RelativeURL) Resolve(url URL) URL
- func (u RelativeURL) String() string
- type Scheme
- type URL
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbsoluteURL ¶
type AbsoluteURL struct {
// contains filtered or unexported fields
}
func AbsoluteURLFromGo ¶
func AbsoluteURLFromGo(url *gurl.URL) (AbsoluteURL, error)
Create a AbsoluteURL from a Go net/url URL.
func AbsoluteURLFromString ¶
func AbsoluteURLFromString(url string) (AbsoluteURL, error)
Creates a AbsoluteURL from its encoded string representation.
func (AbsoluteURL) Equivalent ¶
func (u AbsoluteURL) Equivalent(url URL) bool
Equivalent implements URL
func (AbsoluteURL) IsFile ¶
func (u AbsoluteURL) IsFile() bool
Indicates whether this URL points to a file.
func (AbsoluteURL) IsHTTP ¶
func (u AbsoluteURL) IsHTTP() bool
Indicates whether this URL points to a HTTP resource.
func (AbsoluteURL) Relativize ¶
func (u AbsoluteURL) Relativize(url URL) URL
Relativize implements URL Note that unlike other functions, this can return nil! Logic copied from Java: https://github.com/openjdk/jdk/blob/de90204b60c408ef258a2d2515ad252de4b23536/src/java.base/share/classes/java/net/URI.java#L2269
func (AbsoluteURL) RemoveFragment ¶
func (u AbsoluteURL) RemoveFragment() URL
RemoveFragment implements URL
func (AbsoluteURL) ToFilepath ¶
func (u AbsoluteURL) ToFilepath() string
Converts the URL to a filepath, if it's a file URL.
type RelativeURL ¶
type RelativeURL struct {
// contains filtered or unexported fields
}
Represents a relative Uniform Resource Locator. RelativeURL implements URL
func RelativeURLFromGo ¶
func RelativeURLFromGo(url *gurl.URL) (RelativeURL, error)
Create a RelativeURL from a Go net/url URL.
func RelativeURLFromString ¶
func RelativeURLFromString(url string) (RelativeURL, error)
Creates a RelativeURL from its encoded string representation.
func URLFromDecodedPath ¶
func URLFromDecodedPath(path string) (RelativeURL, error)
Creates a RelativeURL from a percent-decoded path.
func (RelativeURL) Equivalent ¶
func (u RelativeURL) Equivalent(url URL) bool
Equivalent implements URL
func (RelativeURL) Path ¶
func (u RelativeURL) Path() string
func (RelativeURL) Relativize ¶
func (u RelativeURL) Relativize(url URL) URL
Relativize implements URL Note that unlike other functions, this can return nil! Logic copied from Java: https://github.com/openjdk/jdk/blob/de90204b60c408ef258a2d2515ad252de4b23536/src/java.base/share/classes/java/net/URI.java#L2269
func (RelativeURL) RemoveFragment ¶
func (u RelativeURL) RemoveFragment() URL
RemoveFragment implements URL
type URL ¶
type URL interface { Path() string // Decoded path segments identifying a location. Filename() string // Decoded filename portion of the URL path. Extension() string // Extension of the filename portion of the URL path. RemoveQuery() URL // Returns a copy of this URL after dropping its query. Fragment() string // Returns the decoded fragment present in this URL, if any. RemoveFragment() URL // Returns a copy of this URL after dropping its fragment. Resolve(url URL) URL // Resolves the given [url] to this URL. Relativize(url URL) URL // Relativizes the given [url] against this URL. Normalize() URL // Normalizes the URL using a subset of the RFC-3986 rules (https://datatracker.ietf.org/doc/html/rfc3986#section-6). String() string // Encodes the URL to a string. Raw() *gurl.URL // Returns the underlying Go URL. Equivalent(url URL) bool // Returns whether the receiver is equivalent to the given `url` after normalization. }
A Uniform Resource Locator.
func FromEPUBHref ¶
According to the EPUB specification, the HREFs in the EPUB package must be valid URLs (so percent-encoded). Unfortunately, many EPUBs don't follow this rule, and use invalid HREFs such as `my chapter.html` or `/dir/my chapter.html`.
As a workaround, we assume the HREFs are valid percent-encoded URLs, and fallback to decoded paths if we can't parse the URL.
func FromFilepath ¶
func MustURLFromString ¶
A proxy for URLFromString that panics on error.
Directories
¶
Path | Synopsis |
---|---|
Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570).
|
Package uritemplates is a level 3 implementation of RFC 6570 (URI Template, http://tools.ietf.org/html/rfc6570). |