html-proofer 2.3.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/htmlproofer +85 -0
- data/lib/html-proofer/cache.rb +153 -0
- data/lib/html-proofer/check/favicon.rb +15 -0
- data/lib/html-proofer/check/html.rb +21 -0
- data/lib/html-proofer/check/images.rb +47 -0
- data/lib/html-proofer/check/links.rb +120 -0
- data/lib/html-proofer/check/scripts.rb +28 -0
- data/lib/html-proofer/check.rb +63 -0
- data/lib/html-proofer/configuration.rb +56 -0
- data/lib/html-proofer/element.rb +165 -0
- data/lib/{html/proofer/check_runner → html-proofer}/issue.rb +8 -10
- data/lib/html-proofer/log.rb +49 -0
- data/lib/html-proofer/runner.rb +160 -0
- data/lib/html-proofer/url_validator.rb +218 -0
- data/lib/html-proofer/utils.rb +40 -0
- data/lib/html-proofer/version.rb +3 -0
- data/lib/html-proofer.rb +47 -0
- metadata +64 -289
- data/.gitignore +0 -26
- data/.travis.yml +0 -12
- data/Gemfile +0 -3
- data/LICENSE.txt +0 -22
- data/README.md +0 -265
- data/Rakefile +0 -21
- data/bin/htmlproof +0 -71
- data/html-proofer.gemspec +0 -31
- data/lib/html/proofer/check_runner.rb +0 -62
- data/lib/html/proofer/checkable.rb +0 -164
- data/lib/html/proofer/checks/favicon.rb +0 -21
- data/lib/html/proofer/checks/html.rb +0 -40
- data/lib/html/proofer/checks/images.rb +0 -57
- data/lib/html/proofer/checks/links.rb +0 -107
- data/lib/html/proofer/checks/scripts.rb +0 -39
- data/lib/html/proofer/log.rb +0 -38
- data/lib/html/proofer/url_validator.rb +0 -135
- data/lib/html/proofer/utils.rb +0 -24
- data/lib/html/proofer/version.rb +0 -6
- data/lib/html/proofer.rb +0 -189
- data/script/bootstrap +0 -5
- data/spec/html/proofer/checkable_spec.rb +0 -47
- data/spec/html/proofer/command_spec.rb +0 -88
- data/spec/html/proofer/favicon_spec.rb +0 -47
- data/spec/html/proofer/fixtures/favicon/favicon_absent.html +0 -4
- data/spec/html/proofer/fixtures/favicon/favicon_absent_apple.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_broken.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_broken_but_ignored.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_present.html +0 -7
- data/spec/html/proofer/fixtures/favicon/favicon_present_shortcut.html +0 -7
- data/spec/html/proofer/fixtures/html/div_inside_head.html +0 -6
- data/spec/html/proofer/fixtures/html/html5_tags.html +0 -9
- data/spec/html/proofer/fixtures/html/invalid_tag.html +0 -3
- data/spec/html/proofer/fixtures/html/missing_closing_quotes.html +0 -5
- data/spec/html/proofer/fixtures/html/opening_and_ending_tag_mismatch.html +0 -7
- data/spec/html/proofer/fixtures/html/svg_elements.html +0 -729
- data/spec/html/proofer/fixtures/html/unescaped_ampersand_in_attribute.html +0 -4
- data/spec/html/proofer/fixtures/html/unmatched_end_tag.html +0 -5
- data/spec/html/proofer/fixtures/images/emptyImageAltText.html +0 -10
- data/spec/html/proofer/fixtures/images/existingImageExternal.html +0 -9
- data/spec/html/proofer/fixtures/images/gpl.png +0 -0
- data/spec/html/proofer/fixtures/images/ignorableAltViaOptions.html +0 -13
- data/spec/html/proofer/fixtures/images/ignorableImages.html +0 -10
- data/spec/html/proofer/fixtures/images/ignoreAltButNotLink.html +0 -13
- data/spec/html/proofer/fixtures/images/image_missing_protocol_invalid.html +0 -9
- data/spec/html/proofer/fixtures/images/image_missing_protocol_valid.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageAlt.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageAltText.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageExternal.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageInternal.html +0 -9
- data/spec/html/proofer/fixtures/images/missingImageSrc.html +0 -9
- data/spec/html/proofer/fixtures/images/relativeToSelf.html +0 -2
- data/spec/html/proofer/fixtures/images/rootRelativeImages.html +0 -2
- data/spec/html/proofer/fixtures/images/srcSetCheck.html +0 -7
- data/spec/html/proofer/fixtures/images/srcSetIgnorable.html +0 -13
- data/spec/html/proofer/fixtures/images/srcSetMissingAlt.html +0 -7
- data/spec/html/proofer/fixtures/images/srcSetMissingImage.html +0 -7
- data/spec/html/proofer/fixtures/images/terribleImageName.html +0 -9
- data/spec/html/proofer/fixtures/images/workingDataURIImage.html +0 -3
- data/spec/html/proofer/fixtures/links/_site/folder.html/index.html +0 -1
- data/spec/html/proofer/fixtures/links/anchors_in_pre.html +0 -12
- data/spec/html/proofer/fixtures/links/attributeWithDash.html +0 -8
- data/spec/html/proofer/fixtures/links/blank_mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/blank_tel_link.html +0 -9
- data/spec/html/proofer/fixtures/links/brokenHashExternal.html +0 -11
- data/spec/html/proofer/fixtures/links/brokenHashInternal.html +0 -14
- data/spec/html/proofer/fixtures/links/brokenHashOnTheWeb.html +0 -2
- data/spec/html/proofer/fixtures/links/brokenInternalLink.html +0 -0
- data/spec/html/proofer/fixtures/links/brokenLinkExternal.html +0 -11
- data/spec/html/proofer/fixtures/links/brokenLinkInternal.html +0 -10
- data/spec/html/proofer/fixtures/links/brokenLinkWithNumber.html +0 -8
- data/spec/html/proofer/fixtures/links/brokenUnixLinks.html +0 -5
- data/spec/html/proofer/fixtures/links/broken_hash_with_query.html +0 -9
- data/spec/html/proofer/fixtures/links/checkSSLLinks.html +0 -1
- data/spec/html/proofer/fixtures/links/ensure_typhoeus_options.html +0 -1
- data/spec/html/proofer/fixtures/links/erstiebegr%C3%BC%C3%9Fung.html +0 -0
- data/spec/html/proofer/fixtures/links/erstiebegr/303/274/303/237ung.html +0 -0
- data/spec/html/proofer/fixtures/links/escape_pipes.html +0 -9
- data/spec/html/proofer/fixtures/links/file.foo +0 -11
- data/spec/html/proofer/fixtures/links/folder/anchorLink.html +0 -0
- data/spec/html/proofer/fixtures/links/folder/assets/barrel.png +0 -0
- data/spec/html/proofer/fixtures/links/folder/index.html +0 -0
- data/spec/html/proofer/fixtures/links/folder/multiples/catalog/file.html +0 -8
- data/spec/html/proofer/fixtures/links/folder/multiples/javadoc/file.html +0 -8
- data/spec/html/proofer/fixtures/links/folder/relativeImage.html +0 -2
- data/spec/html/proofer/fixtures/links/folder-php/index.php +0 -2
- data/spec/html/proofer/fixtures/links/githubHash.html +0 -1
- data/spec/html/proofer/fixtures/links/gpl.png +0 -0
- data/spec/html/proofer/fixtures/links/hashReferringToSelf.html +0 -44
- data/spec/html/proofer/fixtures/links/head_link_href.html +0 -7
- data/spec/html/proofer/fixtures/links/head_link_href_absent.html +0 -7
- data/spec/html/proofer/fixtures/links/head_link_href_empty.html +0 -7
- data/spec/html/proofer/fixtures/links/ignorableLinks.html +0 -13
- data/spec/html/proofer/fixtures/links/ignorableLinksViaOptions.html +0 -13
- data/spec/html/proofer/fixtures/links/invalid_mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/javascript_link.html +0 -9
- data/spec/html/proofer/fixtures/links/linkToFolder.html +0 -9
- data/spec/html/proofer/fixtures/links/linkTranslatedViaHrefSwap.html +0 -9
- data/spec/html/proofer/fixtures/links/linkWithHttps.html +0 -9
- data/spec/html/proofer/fixtures/links/linkWithRedirect.html +0 -12
- data/spec/html/proofer/fixtures/links/link_directory_without_slash.html +0 -1
- data/spec/html/proofer/fixtures/links/link_missing_protocol_invalid.html +0 -9
- data/spec/html/proofer/fixtures/links/link_missing_protocol_valid.html +0 -9
- data/spec/html/proofer/fixtures/links/link_pointing_to_directory.html +0 -1
- data/spec/html/proofer/fixtures/links/links_in_pre.html +0 -13
- data/spec/html/proofer/fixtures/links/mailto_link.html +0 -9
- data/spec/html/proofer/fixtures/links/missingLinkHref.html +0 -9
- data/spec/html/proofer/fixtures/links/multipleProblems.html +0 -11
- data/spec/html/proofer/fixtures/links/nodupe.html +0 -1
- data/spec/html/proofer/fixtures/links/non_standard_characters.html +0 -10
- data/spec/html/proofer/fixtures/links/notarealhash.html +0 -0
- data/spec/html/proofer/fixtures/links/other_protocols.html +0 -4
- data/spec/html/proofer/fixtures/links/placeholder_with_empty_id.html +0 -1
- data/spec/html/proofer/fixtures/links/placeholder_with_id.html +0 -1
- data/spec/html/proofer/fixtures/links/placeholder_with_name.html +0 -1
- data/spec/html/proofer/fixtures/links/redirected_error.html +0 -1
- data/spec/html/proofer/fixtures/links/relativeLinks.html +0 -4
- data/spec/html/proofer/fixtures/links/rootLink/folder/index.html +0 -1
- data/spec/html/proofer/fixtures/links/rootLink/index.html +0 -1
- data/spec/html/proofer/fixtures/links/rootLink/rootLink.html +0 -9
- data/spec/html/proofer/fixtures/links/tel_link.html +0 -9
- data/spec/html/proofer/fixtures/links/urlencoded-href.html +0 -2
- data/spec/html/proofer/fixtures/links/utf8Link.html +0 -2
- data/spec/html/proofer/fixtures/resources/Screen Shot 2012-08-09 at 7.51.18 AM.png +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/getting-good-with-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/pro-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/assets/version-control-with-git.jpg +0 -0
- data/spec/html/proofer/fixtures/resources/books/nestedRelativeImages.html +0 -5
- data/spec/html/proofer/fixtures/resources/gpl.png +0 -0
- data/spec/html/proofer/fixtures/scripts/ignorableLinksViaOptions.html +0 -4
- data/spec/html/proofer/fixtures/scripts/script.js +0 -1
- data/spec/html/proofer/fixtures/scripts/script_broken_external.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_content.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_content_absent.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_in_pre.html +0 -5
- data/spec/html/proofer/fixtures/scripts/script_missing_internal.html +0 -9
- data/spec/html/proofer/fixtures/scripts/script_valid_internal.html +0 -9
- data/spec/html/proofer/fixtures/sorting/issue/broken_image_one.html +0 -1
- data/spec/html/proofer/fixtures/sorting/issue/broken_image_two.html +0 -4
- data/spec/html/proofer/fixtures/sorting/path/multiple_issues.html +0 -11
- data/spec/html/proofer/fixtures/sorting/path/single_issue.html +0 -1
- data/spec/html/proofer/fixtures/sorting/status/a_404.html +0 -1
- data/spec/html/proofer/fixtures/sorting/status/broken_link.html +0 -3
- data/spec/html/proofer/fixtures/sorting/status/missing_redirect.html +0 -1
- data/spec/html/proofer/fixtures/utils/lang-jp.html +0 -1
- data/spec/html/proofer/html_spec.rb +0 -57
- data/spec/html/proofer/images_spec.rb +0 -147
- data/spec/html/proofer/links_spec.rb +0 -364
- data/spec/html/proofer/scripts_spec.rb +0 -47
- data/spec/html/proofer/utils_spec.rb +0 -14
- data/spec/html/proofer_spec.rb +0 -122
- data/spec/spec_helper.rb +0 -52
data/README.md
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
# HTML::Proofer
|
|
2
|
-
|
|
3
|
-
If you generate HTML files, _then this tool might be for you_.
|
|
4
|
-
|
|
5
|
-
`HTML::Proofer` is a set of tests to validate your HTML output. These tests check if your image references are legitimate, if they have alt tags, if your internal links are working, and so on. It's intended to be an all-in-one checker for your output.
|
|
6
|
-
|
|
7
|
-
[](https://travis-ci.org/gjtorikian/html-proofer) [](http://badge.fury.io/rb/html-proofer)
|
|
8
|
-
|
|
9
|
-
## Installation
|
|
10
|
-
|
|
11
|
-
Add this line to your application's Gemfile:
|
|
12
|
-
|
|
13
|
-
gem 'html-proofer'
|
|
14
|
-
|
|
15
|
-
And then execute:
|
|
16
|
-
|
|
17
|
-
$ bundle
|
|
18
|
-
|
|
19
|
-
Or install it yourself as:
|
|
20
|
-
|
|
21
|
-
$ gem install html-proofer
|
|
22
|
-
|
|
23
|
-
**NOTE:** When installation speed matters, set `NOKOGIRI_USE_SYSTEM_LIBRARIES` to `true` in your environment. This is useful for increasing the speed of your Continuous Integration builds.
|
|
24
|
-
|
|
25
|
-
### Real-life examples
|
|
26
|
-
|
|
27
|
-
Project | Repository
|
|
28
|
-
:--- | :---
|
|
29
|
-
[Raspberry Pi documentation](http://www.raspberrypi.org/documentation/) | [raspberrypi/documentation]( https://github.com/raspberrypi/documentation)
|
|
30
|
-
[Open Whisper Systems website](https://whispersystems.org/) | [WhisperSystems/whispersystems.org](https://github.com/WhisperSystems/whispersystems.org)
|
|
31
|
-
[Jekyll website](http://jekyllrb.com/) | [jekyll/jekyll](https://github.com/jekyll/jekyll)
|
|
32
|
-
|
|
33
|
-
## What's Tested?
|
|
34
|
-
|
|
35
|
-
### Images
|
|
36
|
-
|
|
37
|
-
`img` elements:
|
|
38
|
-
|
|
39
|
-
* Whether all your images have alt tags
|
|
40
|
-
* Whether your internal image references are not broken
|
|
41
|
-
* Whether external images are showing
|
|
42
|
-
|
|
43
|
-
### Links
|
|
44
|
-
|
|
45
|
-
`a`, `link` elements:
|
|
46
|
-
|
|
47
|
-
* Whether your internal links are not broken; this includes hash references (`#linkToMe`)
|
|
48
|
-
* Whether external links are working
|
|
49
|
-
|
|
50
|
-
### Scripts
|
|
51
|
-
|
|
52
|
-
`script` elements:
|
|
53
|
-
|
|
54
|
-
* Whether your internal script references are not broken
|
|
55
|
-
* Whether external scripts are loading
|
|
56
|
-
|
|
57
|
-
### Favicon
|
|
58
|
-
|
|
59
|
-
Checks if your favicons are valid. This is an optional feature, set the `check_favicon` option to turn it on.
|
|
60
|
-
|
|
61
|
-
### HTML
|
|
62
|
-
|
|
63
|
-
Nokogiri looks at the markup and [provides errors](http://www.nokogiri.org/tutorials/ensuring_well_formed_markup.html) when parsing your document.
|
|
64
|
-
This is an optional feature, set the `check_html` option to enable validation errors from Nokogiri.
|
|
65
|
-
|
|
66
|
-
## Usage
|
|
67
|
-
|
|
68
|
-
### Using in a script
|
|
69
|
-
|
|
70
|
-
Require the gem; generate some HTML; create a new instance of the `HTML::Proofer` on
|
|
71
|
-
your output folder; then `run` it. Here's a simple example:
|
|
72
|
-
|
|
73
|
-
```ruby
|
|
74
|
-
require 'html/proofer'
|
|
75
|
-
require 'html/pipeline'
|
|
76
|
-
require 'find'
|
|
77
|
-
|
|
78
|
-
# make an out dir
|
|
79
|
-
Dir.mkdir("out") unless File.exist?("out")
|
|
80
|
-
|
|
81
|
-
pipeline = HTML::Pipeline.new [
|
|
82
|
-
HTML::Pipeline::MarkdownFilter,
|
|
83
|
-
HTML::Pipeline::TableOfContentsFilter
|
|
84
|
-
], :gfm => true
|
|
85
|
-
|
|
86
|
-
# iterate over files, and generate HTML from Markdown
|
|
87
|
-
Find.find("./docs") do |path|
|
|
88
|
-
if File.extname(path) == ".md"
|
|
89
|
-
contents = File.read(path)
|
|
90
|
-
result = pipeline.call(contents)
|
|
91
|
-
|
|
92
|
-
File.open("out/#{path.split("/").pop.sub('.md', '.html')}", 'w') { |file| file.write(result[:output].to_s) }
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
# test your out dir!
|
|
97
|
-
HTML::Proofer.new("./out").run
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
### Using on the command-line
|
|
101
|
-
|
|
102
|
-
You'll get a new program called `htmlproof` with this gem. Terrific!
|
|
103
|
-
|
|
104
|
-
Use it like you'd expect to:
|
|
105
|
-
|
|
106
|
-
``` bash
|
|
107
|
-
htmlproof ./out --href-swap wow:cow,mow:doh --ext .html.erb --href-ignore www.github.com
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
Note: since `href_swap` is a bit special, you'll pass in a pair of `RegEx:String` values.
|
|
111
|
-
`htmlproof` will figure out what you mean.
|
|
112
|
-
|
|
113
|
-
### Using with Jekyll
|
|
114
|
-
|
|
115
|
-
Want to use HTML Proofer with your Jekyll site? Awesome. Simply add `gem 'html-proofer'`
|
|
116
|
-
to your `Gemfile` as described above, and add the following to your `Rakefile`,
|
|
117
|
-
using `rake test` to execute:
|
|
118
|
-
|
|
119
|
-
```ruby
|
|
120
|
-
require 'html/proofer'
|
|
121
|
-
|
|
122
|
-
task :test do
|
|
123
|
-
sh "bundle exec jekyll build"
|
|
124
|
-
HTML::Proofer.new("./_site").run
|
|
125
|
-
end
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Don't have or want a `Rakefile`? You _could_ also do something like the following:
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
htmlproof ./_site
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Configuration
|
|
135
|
-
|
|
136
|
-
The `HTML::Proofer` constructor takes an optional hash of additional options:
|
|
137
|
-
|
|
138
|
-
| Option | Description | Default |
|
|
139
|
-
| :----- | :---------- | :------ |
|
|
140
|
-
| `alt_ignore` | An array of Strings or RegExps containing `img`s whose missing `alt` tags are safe to ignore. | `[]` |
|
|
141
|
-
| `empty_alt_ignore` | If `true`, ignores images with empty alt tags. | `false` |
|
|
142
|
-
| `check_external_hash` | Checks whether external hashes exist (even if the website exists). This slows the checker down. | `false` |
|
|
143
|
-
|`checks_to_ignore`| An array of Strings indicating which checks you'd like to not perform. | `[]`
|
|
144
|
-
| `directory_index_file` | Sets the file to look for when a link refers to a directory. | `index.html` |
|
|
145
|
-
| `disable_external` | If `true`, does not run the external link checker, which can take a lot of time. | `false` |
|
|
146
|
-
| `error_sort` | Defines the sort order for error output. Can be `:path`, `:desc`, or `:status`. | `:path`
|
|
147
|
-
| `ext` | The extension of your HTML files including the dot. | `.html`
|
|
148
|
-
| `file_ignore` | An array of Strings or RegExps containing file paths that are safe to ignore. | `[]` |
|
|
149
|
-
| `href_ignore` | An array of Strings or RegExps containing `href`s that are safe to ignore. Note that non-HTTP(S) URIs are always ignored. | `[]` |
|
|
150
|
-
| `href_swap` | A hash containing key-value pairs of `RegExp => String`. It transforms links that match `RegExp` into `String` via `gsub`. | `{}` |
|
|
151
|
-
| `only_4xx` | Only reports errors for links that fall within the 4xx status code range. | `false` |
|
|
152
|
-
| `url_ignore` | An array of Strings or RegExps containing URLs that are safe to ignore. It affects all HTML attributes. Note that non-HTTP(S) URIs are always ignored. | `[]` |
|
|
153
|
-
| `check_favicon` | Enables the favicon checker. | `false` |
|
|
154
|
-
| `check_html` | Enables HTML validation errors from Nokogiri | `false` |
|
|
155
|
-
| `verbose` | If `true`, outputs extra information as the checking happens. Useful for debugging. | `false` |
|
|
156
|
-
|
|
157
|
-
### Configuring Typhoeus and Hydra
|
|
158
|
-
|
|
159
|
-
[Typhoeus](https://github.com/typhoeus/typhoeus) is used to make fast, parallel requests to external URLs. You can pass in any of Typhoeus' options for the external link checks with the options namespace of `:typhoeus`. For example:
|
|
160
|
-
|
|
161
|
-
``` ruby
|
|
162
|
-
HTML::Proofer.new("out/", {:ext => ".htm", :typhoeus => { :verbose => true, :ssl_verifyhost => 2 } })
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
This sets `HTML::Proofer`'s extensions to use _.htm_, and gives Typhoeus a configuration for it to be verbose, and use specific SSL settings. Check [the Typhoeus documentation](https://github.com/typhoeus/typhoeus#other-curl-options) for more information on what options it can receive.
|
|
166
|
-
|
|
167
|
-
You can similarly pass in a `:hydra` option with a hash configuration for Hydra.
|
|
168
|
-
|
|
169
|
-
The default value is `typhoeus => { :followlocation => true }`.
|
|
170
|
-
|
|
171
|
-
### Configuring Parallel
|
|
172
|
-
|
|
173
|
-
[Parallel](https://github.com/grosser/parallel) is being used to speed internal file checks. You can pass in any of its options with the options "namespace" `:parallel`. For example:
|
|
174
|
-
|
|
175
|
-
``` ruby
|
|
176
|
-
HTML::Proofer.new("out/", {:ext => ".htm", :parallel => { :in_processes => 3} })
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
`:in_processes => 3` will be passed into Parallel as a configuration option.
|
|
180
|
-
|
|
181
|
-
### Array of links
|
|
182
|
-
|
|
183
|
-
Instead of a directory as the first argument, you can also pass in an array of links:
|
|
184
|
-
|
|
185
|
-
``` ruby
|
|
186
|
-
HTML::Proofer.new(["http://github.com", "http://jekyllrb.com"])
|
|
187
|
-
```
|
|
188
|
-
|
|
189
|
-
This configures Proofer to just test those links to ensure they are valid. Note that for the command-line, you'll need to pass a special `--as-links` argument:
|
|
190
|
-
|
|
191
|
-
``` bash
|
|
192
|
-
bin/htmlproof www.google.com,www.github.com --as-links
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## Ignoring content
|
|
196
|
-
|
|
197
|
-
Add the `data-proofer-ignore` attribute to any tag to ignore it from the checks.
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
``` html
|
|
201
|
-
<a href="http://notareallink" data-proofer-ignore>Not checked.</a>
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
## Custom tests
|
|
205
|
-
|
|
206
|
-
Want to write your own test? Sure! Just create two classes--one that inherits from `HTML::Proofer::CheckRunner`, and another that inherits from `HTML::Proofer::Checkable`.
|
|
207
|
-
|
|
208
|
-
The `CheckRunner` subclass must define one method called `run`. This is called on your content, and is responsible for performing the validation on whatever elements you like. When you catch a broken issue, call `add_issue(message)` to explain the error.
|
|
209
|
-
|
|
210
|
-
The `Checkable` subclass defines various helper methods you can use as part of your test. Usually, you'll want to instantiate it within `run`. You have access to all of your element's attributes.
|
|
211
|
-
|
|
212
|
-
Here's an example custom test that protects against `mailto` links that point to `octocat@github.com`:
|
|
213
|
-
|
|
214
|
-
``` ruby
|
|
215
|
-
class OctocatLinkCheck < ::HTML::Proofer::Checkable
|
|
216
|
-
|
|
217
|
-
def mailto?
|
|
218
|
-
return false if @data_ignore_proofer || @href.nil? || @href.empty?
|
|
219
|
-
return @href.match /^mailto\:/
|
|
220
|
-
end
|
|
221
|
-
|
|
222
|
-
def octocat?
|
|
223
|
-
return @href.match /\:octocat@github.com\Z/
|
|
224
|
-
end
|
|
225
|
-
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
class MailToOctocat < ::HTML::Proofer::CheckRunner
|
|
229
|
-
|
|
230
|
-
def run
|
|
231
|
-
@html.css('a').each do |l|
|
|
232
|
-
link = OctocatLinkCheck.new l, self
|
|
233
|
-
|
|
234
|
-
if link.mailto? && link.octocat?
|
|
235
|
-
return add_issue("Don't email the Octocat directly!")
|
|
236
|
-
end
|
|
237
|
-
end
|
|
238
|
-
end
|
|
239
|
-
end
|
|
240
|
-
```
|
|
241
|
-
|
|
242
|
-
## Troubleshooting
|
|
243
|
-
|
|
244
|
-
### Certificates
|
|
245
|
-
|
|
246
|
-
To ignore certificates turn off the Typhoeus SSL verification:
|
|
247
|
-
|
|
248
|
-
``` ruby
|
|
249
|
-
HTML::Proofer.new("out/", {
|
|
250
|
-
:typhoeus => {
|
|
251
|
-
:ssl_verifypeer => false,
|
|
252
|
-
:ssl_verifyhost => 0}
|
|
253
|
-
}).run
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
### User-Agent
|
|
257
|
-
|
|
258
|
-
To change the User-Agent used by Typhoeus:
|
|
259
|
-
|
|
260
|
-
``` ruby
|
|
261
|
-
HTML::Proofer.new("out/", {
|
|
262
|
-
:typhoeus => {
|
|
263
|
-
:headers => { "User-Agent" => "Mozilla/5.0 (compatible; My New User-Agent)" }
|
|
264
|
-
}}).run
|
|
265
|
-
```
|
data/Rakefile
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
require 'bundler'
|
|
2
|
-
Bundler::GemHelper.install_tasks
|
|
3
|
-
|
|
4
|
-
require 'rspec/core/rake_task'
|
|
5
|
-
|
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
7
|
-
|
|
8
|
-
task :default => [:spec, :proof_readme]
|
|
9
|
-
|
|
10
|
-
task :proof_readme do
|
|
11
|
-
require 'html/proofer'
|
|
12
|
-
require 'redcarpet'
|
|
13
|
-
|
|
14
|
-
redcarpet = Redcarpet::Markdown.new Redcarpet::Render::HTML.new({}), {}
|
|
15
|
-
html = redcarpet.render File.read('README.md')
|
|
16
|
-
|
|
17
|
-
mkdir_p 'out'
|
|
18
|
-
File.write('out/README.html', html)
|
|
19
|
-
|
|
20
|
-
HTML::Proofer.new('./out').run
|
|
21
|
-
end
|
data/bin/htmlproof
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ruby
|
|
2
|
-
STDOUT.sync = true
|
|
3
|
-
|
|
4
|
-
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w( .. lib ))
|
|
5
|
-
|
|
6
|
-
require 'html/proofer'
|
|
7
|
-
require 'mercenary'
|
|
8
|
-
require 'rubygems'
|
|
9
|
-
|
|
10
|
-
def to_regex?(item)
|
|
11
|
-
if item.start_with? '/' and item.end_with? '/'
|
|
12
|
-
Regexp.new item[1...-1]
|
|
13
|
-
else
|
|
14
|
-
item
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
Mercenary.program(:htmlproof) do |p|
|
|
19
|
-
p.version Gem::Specification.load(File.join(File.dirname(__FILE__), '..', 'html-proofer.gemspec')).version
|
|
20
|
-
p.description %(Test your rendered HTML files to make sure they're accurate.)
|
|
21
|
-
p.syntax 'htmlproof PATH [options]'
|
|
22
|
-
|
|
23
|
-
p.description 'Runs the HTML-Proofer suite on the files in PATH. For more details, see the README.'
|
|
24
|
-
|
|
25
|
-
p.option 'as_links', '--as-links', 'Assumes that `PATH` is a comma-separated array of links to check.'
|
|
26
|
-
p.option 'alt_ignore', '--alt-ignore image1,[image2,...]', Array, 'Comma-separated list of Strings or RegExps containing `img`s whose missing `alt` tags are safe to ignore'
|
|
27
|
-
p.option 'empty_alt_ignore', '--empty-alt-ignore', 'Ignores images with empty alt tags.'
|
|
28
|
-
p.option 'checks_to_ignore', '--checks-to-ignore check1,[check2,...]', Array, ' An array of Strings indicating which checks you\'d like to not perform.'
|
|
29
|
-
p.option 'check_external_hash', '--check-external-hash', 'Checks whether external hashes exist (even if the website exists). This slows the checker down (default: `false`).'
|
|
30
|
-
p.option 'directory_index_file', '--directory-index-file', String, 'Sets the file to look for when a link refers to a directory. (default: `index.html`)'
|
|
31
|
-
p.option 'disable_external', '--disable-external', 'Disables the external link checker (default: `false`)'
|
|
32
|
-
p.option 'error_sort', '--error-sort SORT', 'Defines the sort order for error output. Can be `path`, `desc`, or `status` (default: `path`).'
|
|
33
|
-
p.option 'ext', '--ext EXT', String, 'The extension of your HTML files (default: `.html`)'
|
|
34
|
-
p.option 'file_ignore', '--file-ignore file1,[file2,...]', Array, 'Comma-separated list of Strings or RegExps containing file paths that are safe to ignore'
|
|
35
|
-
p.option 'href_ignore', '--href-ignore link1,[link2,...]', Array, 'Comma-separated list of Strings or RegExps containing `href`s that are safe to ignore.'
|
|
36
|
-
p.option 'href_swap', '--href-swap re:string,[re:string,...]', Array, 'Comma-separated list of key-value pairs of `RegExp:String`. Transforms links matching `RegExp` into `String`'
|
|
37
|
-
p.option 'only_4xx', '--only-4xx', 'Only reports errors for links that fall within the 4x status code range.'
|
|
38
|
-
p.option 'check_favicon', '--check-favicon', 'Enables the favicon checker (default: `false`).'
|
|
39
|
-
p.option 'check_html', '--check-html', 'Enables HTML validation errors from Nokogiri (default: `false`).'
|
|
40
|
-
p.option 'verbose', '--verbose', 'Enables more verbose logging.'
|
|
41
|
-
|
|
42
|
-
p.action do |args, opts|
|
|
43
|
-
args = ['.'] if args.empty?
|
|
44
|
-
path = args.first
|
|
45
|
-
|
|
46
|
-
options = {}
|
|
47
|
-
|
|
48
|
-
# prepare every to go to proofer
|
|
49
|
-
p.options.select { |o| !opts[o.config_key].nil? }.each do |option|
|
|
50
|
-
if option.return_type.to_s == 'Array' # TODO: is_a? doesn't work here?
|
|
51
|
-
opts[option.config_key] = opts[option.config_key].map { |i| to_regex?(i) }
|
|
52
|
-
end
|
|
53
|
-
options[option.config_key.to_sym] = opts[option.config_key]
|
|
54
|
-
end
|
|
55
|
-
|
|
56
|
-
# some minor manipulation of a special option
|
|
57
|
-
unless opts['href_swap'].nil?
|
|
58
|
-
options[:href_swap] = {}
|
|
59
|
-
opts['href_swap'].each do |s|
|
|
60
|
-
pair = s.split(':', 2)
|
|
61
|
-
options[:href_swap][Regexp.new(pair[0])] = pair[1]
|
|
62
|
-
end
|
|
63
|
-
end
|
|
64
|
-
|
|
65
|
-
options[:error_sort] = opts['error-sort'].to_sym unless opts['error-sort'].nil?
|
|
66
|
-
|
|
67
|
-
path = path.delete(' ').split(',') if opts['as_links']
|
|
68
|
-
|
|
69
|
-
HTML::Proofer.new(path, options).run
|
|
70
|
-
end
|
|
71
|
-
end
|
data/html-proofer.gemspec
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
|
2
|
-
$LOAD_PATH.push File.expand_path('../lib', __FILE__)
|
|
3
|
-
require 'html/proofer/version'
|
|
4
|
-
|
|
5
|
-
Gem::Specification.new do |gem|
|
|
6
|
-
gem.name = 'html-proofer'
|
|
7
|
-
gem.version = HTML::Proofer::VERSION
|
|
8
|
-
gem.authors = ['Garen Torikian']
|
|
9
|
-
gem.email = ['gjtorikian@gmail.com']
|
|
10
|
-
gem.description = %(Test your rendered HTML files to make sure they're accurate.)
|
|
11
|
-
gem.summary = %(A set of tests to validate your HTML output. These tests check if your image references are legitimate, if they have alt tags, if your internal links are working, and so on. It's intended to be an all-in-one checker for your documentation output.)
|
|
12
|
-
gem.homepage = 'https://github.com/gjtorikian/html-proofer'
|
|
13
|
-
gem.license = 'MIT'
|
|
14
|
-
gem.executables = ['htmlproof']
|
|
15
|
-
gem.files = `git ls-files -z`.split("\x0")
|
|
16
|
-
gem.test_files = gem.files.grep(%r{^(spec)/})
|
|
17
|
-
gem.require_paths = ['lib']
|
|
18
|
-
|
|
19
|
-
gem.add_dependency 'mercenary', '~> 0.3.2'
|
|
20
|
-
gem.add_dependency 'nokogiri', '~> 1.5'
|
|
21
|
-
gem.add_dependency 'colored', '~> 1.2'
|
|
22
|
-
gem.add_dependency 'typhoeus', '~> 0.7'
|
|
23
|
-
gem.add_dependency 'yell', '~> 2.0'
|
|
24
|
-
gem.add_dependency 'parallel', '~> 1.3'
|
|
25
|
-
gem.add_dependency 'addressable', '~> 2.3'
|
|
26
|
-
|
|
27
|
-
gem.add_development_dependency 'redcarpet'
|
|
28
|
-
gem.add_development_dependency 'rspec', '~> 3.1'
|
|
29
|
-
gem.add_development_dependency 'rake'
|
|
30
|
-
gem.add_development_dependency 'awesome_print'
|
|
31
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
module HTML
|
|
4
|
-
class Proofer
|
|
5
|
-
# Mostly handles issue management and collecting of external URLs.
|
|
6
|
-
class CheckRunner
|
|
7
|
-
|
|
8
|
-
attr_reader :issues, :src, :path, :options, :typhoeus_opts, :hydra_opts, :parallel_opts, \
|
|
9
|
-
:external_urls, :href_ignores, :url_ignores, :alt_ignores, :empty_alt_ignore
|
|
10
|
-
|
|
11
|
-
def initialize(src, path, html, options, typhoeus_opts, hydra_opts, parallel_opts)
|
|
12
|
-
@src = src
|
|
13
|
-
@path = path
|
|
14
|
-
@html = remove_ignored(html)
|
|
15
|
-
@options = options
|
|
16
|
-
@typhoeus_opts = typhoeus_opts
|
|
17
|
-
@hydra_opts = hydra_opts
|
|
18
|
-
@parallel_opts = parallel_opts
|
|
19
|
-
@issues = []
|
|
20
|
-
@href_ignores = @options[:href_ignore]
|
|
21
|
-
@url_ignores = @options[:url_ignore]
|
|
22
|
-
@alt_ignores = @options[:alt_ignore]
|
|
23
|
-
@empty_alt_ignore = @options[:empty_alt_ignore]
|
|
24
|
-
@external_urls = {}
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def run
|
|
28
|
-
fail NotImplementedError, 'HTML::Proofer::CheckRunner subclasses must implement #run'
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def add_issue(desc, line_number = nil, status = -1)
|
|
32
|
-
@issues << Issue.new(@path, desc, line_number, status)
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def add_to_external_urls(href)
|
|
36
|
-
if @external_urls[href]
|
|
37
|
-
@external_urls[href] << @path
|
|
38
|
-
else
|
|
39
|
-
@external_urls[href] = [@path]
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
def self.checks
|
|
44
|
-
classes = []
|
|
45
|
-
|
|
46
|
-
ObjectSpace.each_object(Class) do |c|
|
|
47
|
-
next unless c.superclass == self
|
|
48
|
-
classes << c
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
classes
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
private
|
|
55
|
-
|
|
56
|
-
def remove_ignored(html)
|
|
57
|
-
html.css('code, pre').each(&:unlink)
|
|
58
|
-
html
|
|
59
|
-
end
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
require 'addressable/uri'
|
|
2
|
-
require_relative './utils'
|
|
3
|
-
|
|
4
|
-
module HTML
|
|
5
|
-
class Proofer
|
|
6
|
-
# Represents the superclass from which all checks derive.
|
|
7
|
-
class Checkable
|
|
8
|
-
include HTML::Utils
|
|
9
|
-
attr_reader :line
|
|
10
|
-
|
|
11
|
-
def initialize(obj, check)
|
|
12
|
-
obj.attributes.each_pair do |attribute, value|
|
|
13
|
-
instance_variable_set("@#{attribute.tr('-:', '_')}".to_sym, value.value)
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
@text = obj.content
|
|
17
|
-
@check = check
|
|
18
|
-
@checked_paths = {}
|
|
19
|
-
@type = self.class.name
|
|
20
|
-
@line = obj.line
|
|
21
|
-
|
|
22
|
-
if @href && @check.options[:href_swap]
|
|
23
|
-
@href = swap(@href, @check.options[:href_swap])
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# fix up missing protocols
|
|
27
|
-
@href.insert 0, 'http:' if @href =~ %r{^//}
|
|
28
|
-
@src.insert 0, 'http:' if @src =~ %r{^//}
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def url
|
|
32
|
-
@src || @srcset || @href || ''
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
def valid?
|
|
36
|
-
!parts.nil?
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def parts
|
|
40
|
-
@parts ||= Addressable::URI.parse url
|
|
41
|
-
rescue URI::Error
|
|
42
|
-
@parts = nil
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
def path
|
|
46
|
-
Addressable::URI.unencode parts.path unless parts.nil?
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
def hash
|
|
50
|
-
parts.fragment unless parts.nil?
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def scheme
|
|
54
|
-
parts.scheme unless parts.nil?
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
# path is to an external server
|
|
58
|
-
def remote?
|
|
59
|
-
%w( http https ).include? scheme
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def non_http_remote?
|
|
63
|
-
!scheme.nil? && !remote?
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def ignore?
|
|
67
|
-
return true if @data_proofer_ignore
|
|
68
|
-
|
|
69
|
-
# ignore base64 encoded images
|
|
70
|
-
if %w(ImageCheckable FaviconCheckable).include? @type
|
|
71
|
-
return true if url.match(/^data:image/)
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
# ignore user defined URLs
|
|
75
|
-
return true if ignores_pattern_check(@check.url_ignores)
|
|
76
|
-
|
|
77
|
-
# ignore user defined hrefs
|
|
78
|
-
if 'LinkCheckable' === @type
|
|
79
|
-
return true if ignores_pattern_check(@check.href_ignores)
|
|
80
|
-
end
|
|
81
|
-
|
|
82
|
-
# ignore user defined alts
|
|
83
|
-
if 'ImageCheckable' === @type
|
|
84
|
-
return true if ignores_pattern_check(@check.alt_ignores)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
def ignore_empty_alt?
|
|
89
|
-
@check.empty_alt_ignore
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
# path is external to the file
|
|
93
|
-
def external?
|
|
94
|
-
!internal?
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
# path is an anchor or a query
|
|
98
|
-
def internal?
|
|
99
|
-
url.start_with? '#', '?'
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
def file_path
|
|
103
|
-
return if path.nil?
|
|
104
|
-
|
|
105
|
-
if path =~ /^\// # path relative to root
|
|
106
|
-
base = File.directory?(@check.src) ? @check.src : File.dirname(@check.src)
|
|
107
|
-
elsif File.exist?(File.expand_path path, @check.src) # relative links, path is a file
|
|
108
|
-
base = File.dirname @check.path
|
|
109
|
-
elsif File.exist?(File.join(File.dirname(@check.path), path)) # relative links in nested dir, path is a file
|
|
110
|
-
base = File.dirname @check.path
|
|
111
|
-
else # relative link, path is a directory
|
|
112
|
-
base = @check.path
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
file = File.join base, path
|
|
116
|
-
|
|
117
|
-
# implicit index support
|
|
118
|
-
if File.directory?(file) && !unslashed_directory?(file)
|
|
119
|
-
file = File.join file, @check.options[:directory_index_file]
|
|
120
|
-
end
|
|
121
|
-
|
|
122
|
-
file
|
|
123
|
-
end
|
|
124
|
-
|
|
125
|
-
# checks if a file exists relative to the current pwd
|
|
126
|
-
def exists?
|
|
127
|
-
return @checked_paths[absolute_path] if @checked_paths.key? absolute_path
|
|
128
|
-
@checked_paths[absolute_path] = File.exist? absolute_path
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
def absolute_path
|
|
132
|
-
path = file_path || @check.path
|
|
133
|
-
File.expand_path path, Dir.pwd
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
def ignores_pattern_check(links)
|
|
137
|
-
links.each do |ignore|
|
|
138
|
-
if ignore.is_a? String
|
|
139
|
-
return true if ignore == url
|
|
140
|
-
elsif ignore.is_a? Regexp
|
|
141
|
-
return true if ignore =~ url
|
|
142
|
-
end
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
false
|
|
146
|
-
end
|
|
147
|
-
|
|
148
|
-
def unslashed_directory?(file)
|
|
149
|
-
File.directory?(file) && !file.end_with?(File::SEPARATOR) && !follow_location?
|
|
150
|
-
end
|
|
151
|
-
|
|
152
|
-
def follow_location?
|
|
153
|
-
@check.typhoeus_opts && @check.typhoeus_opts[:followlocation]
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
private
|
|
157
|
-
|
|
158
|
-
def real_attr(attr)
|
|
159
|
-
attr.to_s unless attr.nil? || attr.empty?
|
|
160
|
-
end
|
|
161
|
-
|
|
162
|
-
end
|
|
163
|
-
end
|
|
164
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
class FaviconCheckable < ::HTML::Proofer::Checkable
|
|
4
|
-
def rel
|
|
5
|
-
@rel
|
|
6
|
-
end
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
class FaviconCheck < ::HTML::Proofer::CheckRunner
|
|
10
|
-
|
|
11
|
-
def run
|
|
12
|
-
@html.xpath('//link[not(ancestor::pre or ancestor::code)]').each do |favicon|
|
|
13
|
-
favicon = FaviconCheckable.new favicon, self
|
|
14
|
-
next if favicon.ignore?
|
|
15
|
-
return if favicon.rel.split(' ').last.eql? 'icon'
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
add_issue 'no favicon specified'
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
end
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
class HtmlCheck < ::HTML::Proofer::CheckRunner
|
|
4
|
-
|
|
5
|
-
# new html5 tags (source: http://www.w3schools.com/html/html5_new_elements.asp)
|
|
6
|
-
# and svg child tags (source: https://developer.mozilla.org/en-US/docs/Web/SVG/Element)
|
|
7
|
-
HTML5_TAGS = %w(article aside bdi details dialog figcaption
|
|
8
|
-
figure footer header main mark menuitem meter
|
|
9
|
-
nav progress rp rt ruby section summary
|
|
10
|
-
time wbr datalist keygen output color date
|
|
11
|
-
datetime datetime-local email month number
|
|
12
|
-
range search tel time url week canvas
|
|
13
|
-
svg audio embed source track video
|
|
14
|
-
altGlyph altGlyphDef altGlyphItem animate
|
|
15
|
-
animateColor animateMotion animateTransform
|
|
16
|
-
circle clipPath color-profile cursor defs
|
|
17
|
-
desc ellipse feBlend feColorMatrix
|
|
18
|
-
feComponentTransfer feComposite feConvolveMatrix
|
|
19
|
-
feDiffuseLighting feDisplacementMap feDistantLight
|
|
20
|
-
feFlood feFuncA feFuncB feFuncG feFuncR feGaussianBlur
|
|
21
|
-
feImage feMerge feMergeNode feMorphology feOffset
|
|
22
|
-
fePointLight feSpecularLighting feSpotLight feTile
|
|
23
|
-
feTurbulence filter font font-face font-face-format
|
|
24
|
-
font-face-name font-face-src font-face-uri
|
|
25
|
-
foreignObject g glyph glyphRef hkern image line
|
|
26
|
-
linearGradient marker mask metadata missing-glyph
|
|
27
|
-
mpath path pattern polygon polyline radialGradient
|
|
28
|
-
rect set stop switch symbol text textPath tref tspan use
|
|
29
|
-
view vkern)
|
|
30
|
-
|
|
31
|
-
def run
|
|
32
|
-
@html.errors.each do |e|
|
|
33
|
-
# Nokogiri (or rather libxml2 underhood) only recognizes html4 tags,
|
|
34
|
-
# so we need to skip errors caused by the new tags in html5
|
|
35
|
-
next if HTML5_TAGS.include? e.to_s[/Tag ([\w-]+) invalid/o, 1]
|
|
36
|
-
|
|
37
|
-
add_issue(e.to_s)
|
|
38
|
-
end
|
|
39
|
-
end
|
|
40
|
-
end
|