-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #108 from alphagov/fix-all-broken-links-forever
Fix all broken links and add link checker
- Loading branch information
Showing
22 changed files
with
503 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
require 'govuk_tech_docs' | ||
|
||
GovukTechDocs.configure(self, livereload: { js_host: "localhost" }) | ||
|
||
DOCS_LOCATION_IN_GEM = Bundler.rubygems.find_name('govuk_tech_docs').first.full_gem_path + "/docs" | ||
|
||
files.watch :source, path: DOCS_LOCATION_IN_GEM | ||
# Check for broken links | ||
require 'html-proofer' | ||
|
||
helpers do | ||
def gem_docs(filename) | ||
raw_markdown = File.read(DOCS_LOCATION_IN_GEM + "/#{filename}") | ||
|
||
# Strip the h1 header from the original markdown file | ||
markdown = raw_markdown.lines[1..-1].join | ||
GovukTechDocs.configure(self, livereload: { js_host: "localhost" }) | ||
|
||
markdown | ||
after_build do |builder| | ||
begin | ||
HTMLProofer.check_directory(config[:build_dir], | ||
{ :assume_extension => true, | ||
:disable_external => true, | ||
:allow_hash_href => true, | ||
:url_swap => { config[:tech_docs][:host] => "" } }).run | ||
rescue RuntimeError => e | ||
abort e.to_s | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.