remove page.go (merge miss from /develop)
This commit is contained in:
1 parent
81ae0c433b
commit
7e18005473
1 file changed
-35
@@ -1,35 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// Page is a struct which defines a single page, which URLs (links and assets) it contains, etc.
|
||||
type Page struct {
|
||||
URL *url.URL
|
||||
Identifier string
|
||||
Title string
|
||||
MediaType string
|
||||
Skipped bool
|
||||
Broken bool
|
||||
Children []*Page
|
||||
}
|
||||
|
||||
// NewPage takes a referring Page + a URL and returns a new &Page{}
|
||||
func NewPage(referrer *Page, rawurl string) (*Page, error) {
|
||||
// determine the base URL so we can resulve this into a full URL
|
||||
baseURL := ""
|
||||
if referrer != nil {
|
||||
baseURL = referrer.URL.String()
|
||||
}
|
||||
|
||||
// resolve URL into a full absolute URL (non-relative)
|
||||
u, err := resolveURL(baseURL, rawurl)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// create struct and return
|
||||
p := &Page{URL: u, Skipped: false, Broken: false, Identifier: stripAnchorFromURL(u)}
|
||||
return p, nil
|
||||
}
|
||||
Reference in new issue
Block a user