Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore <link rel="schema.*" URIs #193

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions htmltest/check-link.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ func (hT *HTMLTest) checkLink(document *htmldoc.Document, node *html.Node) {
return
}

// Ignore rel=schema.*, as URIs from schema links do not have to exist
// Fixes #190
if strings.HasPrefix(attrs["rel"], "schema.") {
return
}

// Create reference
ref, err := htmldoc.NewReference(document, node, attrs["href"])
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions htmltest/check-link_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,13 @@ func TestLinkRelDnsPrefetch(t *testing.T) {
tExpectIssueCount(t, hT, 0)
}

func TestLinkRelSchema(t *testing.T) {
// ignores links with rel="schema.*"
// Fixes #190
hT := tTestFile("fixtures/links/link-rel-schema.html")
tExpectIssueCount(t, hT, 0)
}

func TestAnchorPre(t *testing.T) {
// catches broken links when inside pre or code tags
hT := tTestFileOpts("fixtures/links/anchors_in_pre.html",
Expand Down
2 changes: 2 additions & 0 deletions htmltest/fixtures/links/link-rel-schema.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<link rel="schema.PA" href="http://www.pictureaustralia.org/schemas/pa/" />
<link rel="schema.dcterms" href="http://purl.org/dc/terms/">