-
Notifications
You must be signed in to change notification settings - Fork 31
/
Rakefile
51 lines (43 loc) · 1.53 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'html-proofer'
require 'redcarpet'
require "net/http"
task :checklinks do
sh "echo 'not rebuild site since it supposed to be built already' #bundle exec jekyll build"
options = {
:log_level => :info,
:empty_alt_ignore => true,
:url_ignore => [
# Skip fragment identifiers, as these are not real links
'#',
# Skip links that have been auto-inserted for the 'Edit Source' action (i.e. that match this regexp)
# /github.com\/DasKeyboard/
],
:only_4xx => true,
# Replace canonical links with local links.
# Details: http://tongueroo.com/articles/getting-html-proofer-to-work-with-canonical-url-for-google-seo/
:url_swap => {
# 'https://github.com/DasKeyboard/Daskeyboard.io/' => '/Daskeyboard.io/',
# '/Daskeyboard.io' => '',
# 'https://github.com/metadot/DasKeyboard/' => 'https://github.com/DasKeyboard/Daskeyboard.io/'
}
}
HTMLProofer.check_directory("./_site",{
:typhoeus => {
:ssl_verifypeer => false,
:ssl_verifyhost => 0,
:headers => { "User-Agent" => "Mozilla/5.0 (compatible; My New User-Agent)" }
},
:allow_hash_href => true,
}).run
end
task default: %i(spec proof_readme)
# task :proof_readme do
# renderer = Redcarpet::Render::HTML.new \
# with_toc_data: true
# redcarpet = Redcarpet::Markdown.new(renderer)
# html = redcarpet.render File.read('README.md')
# mkdir_p 'out'
# File.write('out/README.html', html)
# opts = { url_ignore: [/badge.fury.io/] }
# HTMLProofer.check_directory('./out', opts).run
# end