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

Update link tests #79

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion _includes/blocks/tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ul>
{% for tab in include.tabs %}
<li class="tab" id="{{ tab.label | slugify }}-heading" onclick="openTab('{{ tab.label | slugify }}')">
<h3><a>{{ tab.label }}</a></h3>
<h3><span>{{ tab.label }}</span></h3>
</li>
{% endfor %}
</ul>
Expand Down
60 changes: 31 additions & 29 deletions lib/tasks/test.rake
Original file line number Diff line number Diff line change
@@ -1,52 +1,54 @@
require 'iiifc'

namespace :test do
desc 'Check html'
task :html do
opts = {
check_html: true,
assume_extension: true,
validation: {
report_mismatched_tags: true,
report_invalid_tags: true
},
checks_to_ignore: ['LinkCheck']
}
HTMLProofer.check_directory(SITE_DIR, opts).run
end
# desc 'Check html'
# task :html do
# opts = {
# check_html: true,
# assume_extension: true,
# validation: {
# report_mismatched_tags: true,
# report_invalid_tags: true
# },
# checks_to_ignore: ['LinkCheck']
# }
# HTMLProofer.check_directory(SITE_DIR, opts).run
# end

namespace :links do
desc 'Check for internal link errors'
task :internal do
puts 'Checking for internal link errors'
opts = {
checks_to_ignore: ['ImageCheck', 'HtmlCheck', 'ScriptCheck'],
checks: ['Links'],
disable_external: true,
internal_domains: ['localhost:4000']
enforce_https: false,
swap_urls: { %r{^http\://localhost\:4000} => 'https://iiif.io' },
}
HTMLProofer.check_directory(SITE_DIR, opts).run
end

desc 'Check for *iiif.io* link errors'
task :iiif do
puts 'Checking for link errors in *iiif.io* sites'
opts = {
checks_to_ignore: ['ImageCheck', 'HtmlCheck', 'ScriptCheck'],
url_ignore: [/^((?!iiif\.io).)*$/, 'github'] # temporarily ignore iiif.io github repo errors
}
HTMLProofer.check_directory(SITE_DIR, opts).run
end
# desc 'Check for *iiif.io* link errors'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this test doing that is not covered by either the internal link checker, or the external link checker?

# task :iiif do
# puts 'Checking for link errors in *iiif.io* sites'
# opts = {
# checks_to_ignore: ['ImageCheck', 'HtmlCheck', 'ScriptCheck'],
# url_ignore: [/^((?!iiif\.io).)*$/, 'github'] # temporarily ignore iiif.io github repo errors
# }
# HTMLProofer.check_directory(SITE_DIR, opts).run
# end

desc 'Check for external link rot'
task :external do
puts 'Checking for external link errors'
opts = {
external_only: true,
http_status_ignore: [429],
enforce_https: true,
enforce_https: false,
ignore_status_codes: [429],
only_4xx: true,
checks_to_ignore: ['ImageCheck', 'HtmlCheck', 'ScriptCheck'],
url_ignore: [/.*iiif\.io.*/]
swap_urls: { %r{^http\://localhost\:4000} => 'https://iiif.io' },
checks: ['Links','Images'],
ignore_urls: [/.*iiif\.io.*/],
ignore_files: [/.*news\/.*/]
}
HTMLProofer.check_directory(SITE_DIR, opts).run
end
Expand Down