dash-docs/_contrib/bco-htmlproof
David A. Harding ec343d54d1 QA: Check HTML Correctness & Fix Existing Errors
- _contrib/bco-htmlproof: check HTML for correctness; fail on any errors

- _contrib/bco-htmlproof: accept path for individual page to help debug
  page problems

- (Many files) Convert `&` in numerous elements to `&`

- _templates/download.html: use Liquid filter to automatically escape
  `&` in magnet links.  Also premptively tell HTML not to check the
  magnet link when checking external links (this check is not currently
  enabled)

- _releases/*: Escape `<parameter>` used in multiple Bitcoin Core
  release notes

- _templates/choose-you-wallet.html: change mSigna URL from
  .../coinvault&referer=bitcoin.org to .../coinvault?referer=bitcoin.org

- _templates/community.html: fix duplicate anchors by renaming one
  anchor

- _templates/events.html: move Javascript to separate file because it
  contains forbidden HTML close tags within the `<script></script>`
  tags.

- (Many files, mostly in _translations/) Fix many broken open tags or
  missing close tags.

- _translatios/zh_TW.yml & ko.yml: fix a total of three invalid
  characters (control characters)
2015-04-27 09:12:11 -04:00

61 lines
2.2 KiB
Ruby
Executable file

#!/usr/bin/env ruby
require 'html/proofer'
if ARGV[0].nil?
path_to_check="./_site"
else
path_to_check=ARGV[0]
end
## Will throw an exception (exiting false) if any internal links don't
## work. The Makefile will terminate on the failure
HTML::Proofer.new(
## To test, uncomment the array below and comment out ./_site and :disable_external
#[ "/foo/bar#baz", "/foo/bar", "#", "#wallet", "/foo.css", "/bar.png", "/zh_TW/bitcoin-for-businesses" ],
path_to_check,
{
## Disable external link checking by default to avoid spurious
## Travis CI failures. TODO: take an argument to optionally
## enable external link checking as part of the Makefile
## manual checks
:disable_external => true,
## Check whether HTML is well-formed
:check_html => true,
## Links to ignore
:href_ignore => [
'#', ## hrefs pointing to the current page (htmlproofer fails them)
/^\/bin/, ## /bin dir is not part of repository; holds Bitcoin Core binaries
/^\/stats/ ## /stats dir is not part of repository; generated by separate stats script
],
## Mangle links. If we enable external link checking, this will
## require updating
:href_swap => {
## (Hack) Append '$' to the ends of filenames we don't want to append .html to
/(css|png|rss|pdf|jpg|asc)$/ => '\1$',
## Append .html to end of most URLs so proofer can find the local files
/^(
[^#]+ ## Don't match URL containing a hash, we'll deal with them separately
[^\/$] ## Don't match URLs ending in a slash or $
)$/x => '\1.html',
## Insert .html between page and anchor, but only if there's a
## page name
/^(.+)(#.+)/ => '\1.html\2',
## (Un-hack) Remove previously-appended '$' from URLs
/\$$/ => '',
},
## It'd be nice if we had a _local_config.yaml file or something
## for settings specific to particular systems, but for now I
## think 2 is a good setting for Travis CI ("1.5 processors")
## and me (usually 2 processors)
:parallel => { :in_processes => 2 }
}
).run