html-proofer-mailto_awesome 1.0.6 → 2.1.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/.editorconfig +13 -0
- data/.github/FUNDING.yml +1 -1
- data/.github/workflows/lint.yml +30 -0
- data/.github/workflows/ruby.yml +22 -23
- data/.gitignore +6 -1
- data/.markdownlint.json +3 -0
- data/.prettierignore +1 -0
- data/Gemfile.lock +83 -50
- data/README.md +109 -49
- data/bin/console +1 -1
- data/html-proofer-mailto_awesome.gemspec +18 -6
- data/lib/html/proofer/mailto_awesome/version.rb +4 -2
- data/lib/html-proofer-mailto_awesome.rb +3 -0
- data/lib/mailto_awesome.rb +53 -25
- metadata +35 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6411236c394f40f47f399843d66e72fd0c23dbeff791b9f424b17b1d3109d00d
|
|
4
|
+
data.tar.gz: aec40d5251f5ae89c1fb928a22d42c94a4838b0ec10c21ad4cb6701f877690fd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1656ce1159562e5a4247f852f69290f8442dea492d842dcbc82e79c828edb9a5e18d36b71a8b6474c63c8d3bc4d69609ffd17efa752f204a75a58972cd3bd85d
|
|
7
|
+
data.tar.gz: e7d4983774757825b40c346932b736790a2f1553027f4995c50cc79902043523f7433dab3c2e963ab948e15f85a095223d7a9ee33110b1e8a1f5bc61ec17ec1b
|
data/.editorconfig
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# UTF-8, LF, and spaces. Trailing whitespace is kept so a Markdown hard break (two spaces) stays intact.
|
|
2
|
+
root = true
|
|
3
|
+
|
|
4
|
+
[*]
|
|
5
|
+
charset = utf-8
|
|
6
|
+
end_of_line = lf
|
|
7
|
+
indent_style = space
|
|
8
|
+
insert_final_newline = true
|
|
9
|
+
trim_trailing_whitespace = false
|
|
10
|
+
max_line_length = 120
|
|
11
|
+
|
|
12
|
+
[*.md]
|
|
13
|
+
max_line_length = off
|
data/.github/FUNDING.yml
CHANGED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
name: Lint
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: ["main"]
|
|
6
|
+
pull_request:
|
|
7
|
+
# Runs on all pull requests targeting any branch
|
|
8
|
+
branches: ["**"]
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
lint:
|
|
12
|
+
name: Prettier & Markdownlint
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- name: Checkout code
|
|
17
|
+
uses: actions/checkout@v7
|
|
18
|
+
|
|
19
|
+
- name: Setup Node.js (tool runtime)
|
|
20
|
+
uses: actions/setup-node@v7
|
|
21
|
+
with:
|
|
22
|
+
node-version: "lts/*" # Floating version is appropriate specifically for Prettier and markdownlint
|
|
23
|
+
|
|
24
|
+
- name: Check formatting (Prettier)
|
|
25
|
+
# Command fails if any files do not meet the formatting rules.
|
|
26
|
+
run: npx prettier@latest --check .
|
|
27
|
+
|
|
28
|
+
- name: Check Markdown (markdownlint)
|
|
29
|
+
# Command fails if any markdown files do not meet the linting rules.
|
|
30
|
+
run: npx markdownlint-cli@latest "**/*.md" --ignore "node_modules"
|
data/.github/workflows/ruby.yml
CHANGED
|
@@ -1,38 +1,37 @@
|
|
|
1
|
-
#
|
|
2
|
-
#
|
|
3
|
-
# separate terms of service, privacy policy, and support
|
|
4
|
-
# documentation.
|
|
5
|
-
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
|
6
|
-
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
|
1
|
+
# Ruby branches still in normal or security maintenance:
|
|
2
|
+
# https://www.ruby-lang.org/en/downloads/branches/
|
|
7
3
|
|
|
8
|
-
name:
|
|
4
|
+
name: Test
|
|
9
5
|
|
|
10
6
|
on:
|
|
11
7
|
push:
|
|
12
|
-
branches: [
|
|
8
|
+
branches: ["main"]
|
|
13
9
|
pull_request:
|
|
14
|
-
branches: [
|
|
10
|
+
branches: ["**"]
|
|
15
11
|
|
|
16
12
|
permissions:
|
|
17
13
|
contents: read
|
|
18
14
|
|
|
15
|
+
concurrency:
|
|
16
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
17
|
+
cancel-in-progress: true
|
|
18
|
+
|
|
19
19
|
jobs:
|
|
20
20
|
test:
|
|
21
|
-
|
|
22
21
|
runs-on: ubuntu-latest
|
|
23
22
|
strategy:
|
|
23
|
+
fail-fast: false
|
|
24
24
|
matrix:
|
|
25
|
-
ruby-version: [
|
|
26
|
-
|
|
25
|
+
ruby-version: ["3.3", "3.4", "4.0"]
|
|
27
26
|
steps:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
27
|
+
- name: Checkout code
|
|
28
|
+
uses: actions/checkout@v7
|
|
29
|
+
|
|
30
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
|
31
|
+
uses: ruby/setup-ruby@v1
|
|
32
|
+
with:
|
|
33
|
+
ruby-version: ${{ matrix.ruby-version }}
|
|
34
|
+
bundler-cache: true
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.markdownlint.json
ADDED
data/.prettierignore
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
*.md
|
data/Gemfile.lock
CHANGED
|
@@ -1,85 +1,118 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
html-proofer-mailto_awesome (1.0
|
|
4
|
+
html-proofer-mailto_awesome (2.1.0)
|
|
5
5
|
html-proofer (~> 5.0, >= 5.0.4)
|
|
6
|
+
logger
|
|
6
7
|
|
|
7
8
|
GEM
|
|
8
9
|
remote: https://rubygems.org/
|
|
9
10
|
specs:
|
|
10
|
-
Ascii85 (
|
|
11
|
-
addressable (2.
|
|
12
|
-
public_suffix (>= 2.0.2, <
|
|
11
|
+
Ascii85 (2.0.1)
|
|
12
|
+
addressable (2.9.0)
|
|
13
|
+
public_suffix (>= 2.0.2, < 8.0)
|
|
13
14
|
afm (0.2.2)
|
|
14
|
-
async (2.
|
|
15
|
-
console (~> 1.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
async (2.21.2)
|
|
16
|
+
console (~> 1.29)
|
|
17
|
+
fiber-annotation
|
|
18
|
+
io-event (~> 1.6, >= 1.6.5)
|
|
19
|
+
benchmark (0.5.0)
|
|
20
|
+
bigdecimal (3.2.3)
|
|
21
|
+
console (1.30.2)
|
|
22
|
+
fiber-annotation
|
|
23
|
+
fiber-local (~> 1.1)
|
|
24
|
+
json
|
|
25
|
+
diff-lcs (1.6.2)
|
|
26
|
+
ethon (0.15.0)
|
|
22
27
|
ffi (>= 1.15.0)
|
|
23
|
-
ffi (1.
|
|
24
|
-
|
|
28
|
+
ffi (1.17.4-aarch64-linux-gnu)
|
|
29
|
+
ffi (1.17.4-aarch64-linux-musl)
|
|
30
|
+
ffi (1.17.4-arm-linux-gnu)
|
|
31
|
+
ffi (1.17.4-arm-linux-musl)
|
|
32
|
+
ffi (1.17.4-arm64-darwin)
|
|
33
|
+
ffi (1.17.4-x86_64-darwin)
|
|
34
|
+
ffi (1.17.4-x86_64-linux-gnu)
|
|
35
|
+
ffi (1.17.4-x86_64-linux-musl)
|
|
36
|
+
fiber-annotation (0.2.0)
|
|
37
|
+
fiber-local (1.1.0)
|
|
38
|
+
fiber-storage
|
|
39
|
+
fiber-storage (1.0.1)
|
|
25
40
|
hashery (2.1.2)
|
|
26
|
-
html-proofer (5.
|
|
41
|
+
html-proofer (5.2.2)
|
|
27
42
|
addressable (~> 2.3)
|
|
28
43
|
async (~> 2.1)
|
|
44
|
+
benchmark (~> 0.5)
|
|
29
45
|
nokogiri (~> 1.13)
|
|
30
46
|
pdf-reader (~> 2.11)
|
|
31
47
|
rainbow (~> 3.0)
|
|
32
48
|
typhoeus (~> 1.3)
|
|
33
49
|
yell (~> 2.0)
|
|
34
50
|
zeitwerk (~> 2.5)
|
|
35
|
-
io-event (1.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
51
|
+
io-event (1.11.2)
|
|
52
|
+
json (2.15.2.1)
|
|
53
|
+
logger (1.7.0)
|
|
54
|
+
nokogiri (1.19.4-aarch64-linux-gnu)
|
|
39
55
|
racc (~> 1.4)
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
56
|
+
nokogiri (1.19.4-aarch64-linux-musl)
|
|
57
|
+
racc (~> 1.4)
|
|
58
|
+
nokogiri (1.19.4-arm-linux-gnu)
|
|
59
|
+
racc (~> 1.4)
|
|
60
|
+
nokogiri (1.19.4-arm-linux-musl)
|
|
61
|
+
racc (~> 1.4)
|
|
62
|
+
nokogiri (1.19.4-arm64-darwin)
|
|
63
|
+
racc (~> 1.4)
|
|
64
|
+
nokogiri (1.19.4-x86_64-darwin)
|
|
65
|
+
racc (~> 1.4)
|
|
66
|
+
nokogiri (1.19.4-x86_64-linux-gnu)
|
|
67
|
+
racc (~> 1.4)
|
|
68
|
+
nokogiri (1.19.4-x86_64-linux-musl)
|
|
69
|
+
racc (~> 1.4)
|
|
70
|
+
pdf-reader (2.15.0)
|
|
71
|
+
Ascii85 (>= 1.0, < 3.0, != 2.0.0)
|
|
72
|
+
afm (>= 0.2.1, < 2)
|
|
43
73
|
hashery (~> 2.0)
|
|
44
74
|
ruby-rc4
|
|
45
75
|
ttfunk
|
|
46
|
-
public_suffix (
|
|
47
|
-
racc (1.
|
|
76
|
+
public_suffix (6.0.2)
|
|
77
|
+
racc (1.8.1)
|
|
48
78
|
rainbow (3.1.1)
|
|
49
|
-
rake (13.0
|
|
50
|
-
rspec (3.
|
|
51
|
-
rspec-core (~> 3.
|
|
52
|
-
rspec-expectations (~> 3.
|
|
53
|
-
rspec-mocks (~> 3.
|
|
54
|
-
rspec-core (3.
|
|
55
|
-
rspec-support (~> 3.
|
|
56
|
-
rspec-expectations (3.
|
|
79
|
+
rake (13.3.0)
|
|
80
|
+
rspec (3.13.1)
|
|
81
|
+
rspec-core (~> 3.13.0)
|
|
82
|
+
rspec-expectations (~> 3.13.0)
|
|
83
|
+
rspec-mocks (~> 3.13.0)
|
|
84
|
+
rspec-core (3.13.5)
|
|
85
|
+
rspec-support (~> 3.13.0)
|
|
86
|
+
rspec-expectations (3.13.5)
|
|
57
87
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
58
|
-
rspec-support (~> 3.
|
|
59
|
-
rspec-mocks (3.
|
|
88
|
+
rspec-support (~> 3.13.0)
|
|
89
|
+
rspec-mocks (3.13.5)
|
|
60
90
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
61
|
-
rspec-support (~> 3.
|
|
62
|
-
rspec-support (3.
|
|
91
|
+
rspec-support (~> 3.13.0)
|
|
92
|
+
rspec-support (3.13.6)
|
|
63
93
|
ruby-rc4 (0.1.5)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
ethon (>= 0.9.0)
|
|
69
|
-
vcr (6.1.0)
|
|
94
|
+
ttfunk (1.8.0)
|
|
95
|
+
bigdecimal (~> 3.1)
|
|
96
|
+
typhoeus (1.5.0)
|
|
97
|
+
ethon (>= 0.9.0, < 0.16.0)
|
|
70
98
|
yell (2.2.2)
|
|
71
|
-
zeitwerk (2.6.
|
|
99
|
+
zeitwerk (2.6.18)
|
|
72
100
|
|
|
73
101
|
PLATFORMS
|
|
74
|
-
|
|
102
|
+
aarch64-linux-gnu
|
|
103
|
+
aarch64-linux-musl
|
|
104
|
+
arm-linux-gnu
|
|
105
|
+
arm-linux-musl
|
|
106
|
+
arm64-darwin
|
|
107
|
+
x86_64-darwin
|
|
108
|
+
x86_64-linux-gnu
|
|
109
|
+
x86_64-linux-musl
|
|
75
110
|
|
|
76
111
|
DEPENDENCIES
|
|
77
|
-
bundler (
|
|
112
|
+
bundler (>= 2.0)
|
|
78
113
|
html-proofer-mailto_awesome!
|
|
79
|
-
rake (
|
|
80
|
-
rspec (~> 3.12
|
|
81
|
-
timecop (~> 0.9, >= 0.9.6)
|
|
82
|
-
vcr (~> 6.1, >= 6.1.0)
|
|
114
|
+
rake (>= 13.0)
|
|
115
|
+
rspec (~> 3.12)
|
|
83
116
|
|
|
84
117
|
BUNDLED WITH
|
|
85
|
-
2.
|
|
118
|
+
2.6.9
|
data/README.md
CHANGED
|
@@ -1,80 +1,140 @@
|
|
|
1
|
-
 [](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/ruby.yml)
|
|
2
|
-
|
|
3
1
|
# html-proofer-mailto_awesome
|
|
4
|
-
A custom [html-proofer](https://github.com/gjtorikian/html-proofer) test that makes your `mailto:` links awesome.
|
|
5
2
|
|
|
6
|
-
|
|
3
|
+
 [](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/ruby.yml) [](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/lint.yml)
|
|
4
|
+
|
|
5
|
+
An [html-proofer](https://github.com/gjtorikian/html-proofer) check that requires `mailto:` links to carry the header fields you want every message to start with.
|
|
6
|
+
|
|
7
|
+
## What an awesome mailto link is
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
People send email we did not ask for. A bare `mailto:` link opens a blank message, and the sender fills that blank with whatever is on their mind. Prefilling the subject and the body makes the useful message the path of least resistance. Replacing it takes effort.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
This is a not-awesome link:
|
|
11
12
|
|
|
12
13
|
```html
|
|
13
14
|
<a href="mailto:support@pacificmedicaltraining.com">Email us</a>
|
|
14
15
|
```
|
|
15
16
|
|
|
16
|
-
This is an awesome link:
|
|
17
|
+
This is an awesome link. The subject and the body are already there:
|
|
17
18
|
|
|
18
19
|
```html
|
|
19
|
-
<a
|
|
20
|
+
<a
|
|
21
|
+
href="mailto:support@pacificmedicaltraining.com?subject=Signing%20up&body=Hello%2C%0AI%20would%20like%20to%20sign%20up."
|
|
22
|
+
>
|
|
23
|
+
Email us
|
|
24
|
+
</a>
|
|
20
25
|
```
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
[RFC 6068](https://www.rfc-editor.org/rfc/rfc6068) is the `mailto:` URI scheme. In HTML, write `&` for an ampersand inside the attribute. Header field names are case-insensitive. `Subject` and `subject` are the same field.
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
The same rule is published for HTML-validate as [`nice-checkers/mailto-awesome`](https://github.com/fulldecent/html-validate-nice-checkers#nice-checkersmailto-awesome).
|
|
25
30
|
|
|
26
|
-
|
|
31
|
+
## Installation
|
|
27
32
|
|
|
28
|
-
|
|
33
|
+
This gem runs on the Ruby branches that are still in normal or security maintenance: 3.3, 3.4, and 4.0. The list is [Ruby maintenance branches](https://www.ruby-lang.org/en/downloads/branches/). Install one of those Rubies from that page.
|
|
29
34
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
In Gemfile:
|
|
33
|
-
|
|
34
|
-
gem 'html-proofer-mailto_awesome'
|
|
35
|
-
|
|
36
|
-
Or in your .gemspec:
|
|
35
|
+
Add the gem to the application that builds or checks the site:
|
|
37
36
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
2. Create a Rakefile like the following and add it to your project
|
|
37
|
+
```ruby
|
|
38
|
+
gem "html-proofer-mailto_awesome"
|
|
39
|
+
```
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
desc 'run Rspec specs'
|
|
48
|
-
task :test do
|
|
49
|
-
sh 'rspec spec'
|
|
50
|
-
end
|
|
51
|
-
|
|
52
|
-
3. Run `bundle install`
|
|
41
|
+
Then install:
|
|
53
42
|
|
|
54
|
-
|
|
43
|
+
```sh
|
|
44
|
+
bundle install
|
|
45
|
+
```
|
|
55
46
|
|
|
56
|
-
|
|
47
|
+
## Usage
|
|
57
48
|
|
|
58
|
-
|
|
49
|
+
html-proofer runs only the checks named in `checks`. That option replaces the default list, which is `Links`, `Images`, and `Scripts`. Include those names when you still want them, and add `MailtoAwesome`.
|
|
59
50
|
|
|
60
|
-
|
|
51
|
+
Require this gem before `run`. html-proofer discovers the check by looking at classes that are already loaded.
|
|
61
52
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
For additional tests you can run on your website, see [Lightning Sites](https://github.com/fulldecent/lightning-sites) and for a sample GitHub project that implements this testing and follows many other HTML development best practices, see [HTML Website Template](https://github.com/fulldecent/html-website-template).
|
|
53
|
+
```ruby
|
|
54
|
+
require "html-proofer"
|
|
55
|
+
require "html-proofer-mailto_awesome"
|
|
66
56
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
desc "Check the built site"
|
|
58
|
+
task :test do
|
|
59
|
+
HTMLProofer.check_directory("_site", {
|
|
60
|
+
checks: ["Links", "Images", "Scripts", "MailtoAwesome"],
|
|
61
|
+
}).run
|
|
62
|
+
end
|
|
70
63
|
|
|
71
|
-
|
|
64
|
+
task default: :test
|
|
65
|
+
```
|
|
72
66
|
|
|
73
|
-
|
|
67
|
+
Run it with Bundler so the gem is on the load path:
|
|
74
68
|
|
|
75
69
|
```sh
|
|
76
|
-
|
|
77
|
-
|
|
70
|
+
bundle exec rake
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`MailtoAwesome` looks at `a` elements. A `mailto:` link passes when every required header field is present. The default required fields are `subject` and `body`. An empty value still counts as present (`subject=`). Text in the address, such as `mailto:subject=trick@example.com`, is not a header field.
|
|
74
|
+
|
|
75
|
+
A link that omits a field fails with `mailto: link is missing required parameters: subject, body`. A `mailto:` value that Ruby cannot parse as a URI fails with `mailto: link is malformed and could not be parsed.`
|
|
76
|
+
|
|
77
|
+
`data-proofer-ignore` skips the link, as it does for the other html-proofer checks.
|
|
78
|
+
|
|
79
|
+
## Configuration
|
|
80
|
+
|
|
81
|
+
`mailto_awesome.required_parameters` replaces the default list. This matches the HTML-validate rule, which uses `requiredParameters` for the same purpose. Pass an empty array when you want the check loaded and no fields required.
|
|
82
|
+
|
|
83
|
+
```ruby
|
|
84
|
+
HTMLProofer.check_directory("_site", {
|
|
85
|
+
checks: ["Links", "Images", "Scripts", "MailtoAwesome"],
|
|
86
|
+
mailto_awesome: {
|
|
87
|
+
required_parameters: ["subject", "body"],
|
|
88
|
+
},
|
|
89
|
+
}).run
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Development
|
|
93
|
+
|
|
94
|
+
Clone the repository and install the gems it uses to test itself:
|
|
95
|
+
|
|
96
|
+
```sh
|
|
97
|
+
git clone https://github.com/fulldecent/html-proofer-mailto_awesome.git
|
|
98
|
+
cd html-proofer-mailto_awesome
|
|
99
|
+
bundle install
|
|
100
|
+
bundle exec rake
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
Format the files the lint workflow checks. These commands call `@latest` on purpose. A pinned copy would let your machine rewrite files one way and continuous integration reject them another way. [node.js-template](https://github.com/fulldecent/node.js-template) records that constraint on its `format` script.
|
|
104
|
+
|
|
105
|
+
```sh
|
|
106
|
+
npx prettier@latest --write .
|
|
107
|
+
npx markdownlint-cli@latest --fix "**/*.md" --ignore node_modules
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
`*.md` is in `.prettierignore`. Prettier does not wrap Markdown. markdownlint does, and [`.markdownlint.json`](.markdownlint.json) turns off the line-length rule.
|
|
111
|
+
|
|
112
|
+
## Releasing
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
gem install bump
|
|
116
|
+
bump patch # or minor, or major
|
|
117
|
+
rm -f html-proofer-mailto_awesome-*.gem
|
|
78
118
|
gem build html-proofer-mailto_awesome.gemspec
|
|
79
119
|
gem push html-proofer-mailto_awesome-*.gem
|
|
80
|
-
```
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Rubygems requires MFA for this gem (`rubygems_mfa_required`).
|
|
123
|
+
|
|
124
|
+
## Maintenance
|
|
125
|
+
|
|
126
|
+
Do this every month or so:
|
|
127
|
+
|
|
128
|
+
1. Read [Ruby maintenance branches](https://www.ruby-lang.org/en/downloads/branches/). Update `required_ruby_version` and the Ruby matrix in [`.github/workflows/ruby.yml`](.github/workflows/ruby.yml) when a branch leaves security maintenance, or when a new branch enters normal maintenance.
|
|
129
|
+
1. Review external actions in [`.github/workflows`](.github/workflows). GitHub-supported actions, the ones under the `actions/` organization, need a short review. `ruby/setup-ruby` is not one of those. Read its changelog before moving the tag.
|
|
130
|
+
1. Review `html-proofer` against the [5.x releases](https://github.com/gjtorikian/html-proofer/releases). This gem depends on `~> 5.0`, `>= 5.0.4`. It also depends on `logger`, because [Ruby 4.0 removed that library from the default gems](https://stdgems.org/libraries/logger/) and html-proofer still loads it.
|
|
131
|
+
1. Keep `ffi` at 1.17.4 or newer, and `nokogiri` at 1.19.0 or newer, in `Gemfile.lock`. The x86_64-linux builds of ffi 1.17.2 and nokogiri 1.18.10 set `required_ruby_version` to `< 3.5.dev`, so `bundle install` fails on Ruby 4.0. ffi 1.17.4 and nokogiri 1.19.4 allow Ruby before 4.1. ethon pulls in ffi. html-proofer pulls in nokogiri.
|
|
132
|
+
|
|
133
|
+
## References
|
|
134
|
+
|
|
135
|
+
1. We use title case for titles and proper nouns; not for headings and things. This includes our README above as well as our workflow rules and other configuration files. If you have a different policy, then please implement it throughout.
|
|
136
|
+
1. This project is released under the [MIT license](LICENSE).
|
|
137
|
+
1. This project is built based on [best practices documented in node.js-template](https://github.com/fulldecent/node.js-template). We took its lint workflow (Prettier and markdownlint, both invoked as `npx @latest`), [`.editorconfig`](.editorconfig), [`.markdownlint.json`](.markdownlint.json), [`.prettierignore`](.prettierignore), and this references section. We did not take its Yarn install or its `.node-version` pin. This is a Ruby gem. The lint job uses Node only as the tool runtime for those two checkers.
|
|
138
|
+
1. The check follows [`nice-checkers/mailto-awesome`](https://github.com/fulldecent/html-validate-nice-checkers#nice-checkersmailto-awesome) in [@fulldecent/nice-checkers-plugin](https://github.com/fulldecent/html-validate-nice-checkers): default required fields are `subject` and `body`, and the caller can replace that list. Delta: this gem compares header field names case-insensitively because [RFC 6068 section 2](https://www.rfc-editor.org/rfc/rfc6068#section-2) says `<hfname>` is case-insensitive. The HTML-validate rule uses `URLSearchParams`, which compares names case-sensitively.
|
|
139
|
+
1. html-proofer custom checks are loaded by class name and selected with the `checks` option. Passing `checks` replaces the default list. That behavior is documented in the [html-proofer README](https://github.com/gjtorikian/html-proofer#custom-tests).
|
|
140
|
+
1. Ruby versions in the gemspec and in continuous integration are the branches still in normal or security maintenance, from [Ruby maintenance branches](https://www.ruby-lang.org/en/downloads/branches/). Ruby 4.0 does not ship `logger` as a default gem. This gem depends on the [`logger` gem](https://stdgems.org/libraries/logger/) so html-proofer can load on that Ruby.
|
data/bin/console
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
3
|
require "bundler/setup"
|
|
4
|
-
require "html
|
|
4
|
+
require "html-proofer-mailto_awesome"
|
|
5
5
|
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
|
@@ -21,10 +21,22 @@ Gem::Specification.new do |spec|
|
|
|
21
21
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
22
22
|
spec.require_paths = ["lib"]
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
spec.
|
|
27
|
-
|
|
28
|
-
spec.
|
|
29
|
-
|
|
24
|
+
# Ruby branches that are still in normal or security maintenance:
|
|
25
|
+
# https://www.ruby-lang.org/en/downloads/branches/
|
|
26
|
+
spec.required_ruby_version = ">= 3.3.0"
|
|
27
|
+
|
|
28
|
+
spec.metadata = {
|
|
29
|
+
"bug_tracker_uri" => "https://github.com/fulldecent/html-proofer-mailto_awesome/issues",
|
|
30
|
+
"source_code_uri" => "https://github.com/fulldecent/html-proofer-mailto_awesome",
|
|
31
|
+
"homepage_uri" => "https://github.com/fulldecent/html-proofer-mailto_awesome",
|
|
32
|
+
"rubygems_mfa_required" => "true"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
spec.add_dependency "html-proofer", "~> 5.0", ">= 5.0.4"
|
|
36
|
+
# Ruby 4.0 removed logger from the default gems. html-proofer still loads it.
|
|
37
|
+
# https://stdgems.org/libraries/logger/
|
|
38
|
+
spec.add_dependency "logger"
|
|
39
|
+
spec.add_development_dependency "bundler", ">= 2.0"
|
|
40
|
+
spec.add_development_dependency "rake", ">= 13.0"
|
|
41
|
+
spec.add_development_dependency "rspec", "~> 3.12"
|
|
30
42
|
end
|
data/lib/mailto_awesome.rb
CHANGED
|
@@ -1,32 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require "html/proofer/mailto_awesome/version"
|
|
4
|
+
# Ruby 4.0 removed logger from the default gems. html-proofer still loads it.
|
|
5
|
+
# https://stdgems.org/libraries/logger/
|
|
6
|
+
require "logger"
|
|
7
|
+
require "html-proofer"
|
|
8
|
+
require "uri"
|
|
2
9
|
|
|
3
|
-
module
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if mailto? && !awesome?
|
|
25
|
-
add_issue("This is a not-awesome mailto link!", line: line, content: content)
|
|
26
|
-
end
|
|
10
|
+
module HTMLProofer
|
|
11
|
+
class Check
|
|
12
|
+
# Reports mailto links that omit the header fields a recipient asked for.
|
|
13
|
+
# Header field names follow RFC 6068: hfname is case-insensitive.
|
|
14
|
+
# https://www.rfc-editor.org/rfc/rfc6068#section-2
|
|
15
|
+
class MailtoAwesome < HTMLProofer::Check
|
|
16
|
+
DEFAULT_REQUIRED_PARAMETERS = ["subject", "body"].freeze
|
|
17
|
+
|
|
18
|
+
def run
|
|
19
|
+
@html.css("a").each do |node|
|
|
20
|
+
@link = create_element(node)
|
|
21
|
+
next if @link.ignore?
|
|
22
|
+
|
|
23
|
+
href = node["href"]
|
|
24
|
+
next unless href.is_a?(String) && href.match?(/\Amailto:/i)
|
|
25
|
+
|
|
26
|
+
begin
|
|
27
|
+
names = header_names(href)
|
|
28
|
+
rescue URI::InvalidURIError
|
|
29
|
+
add_failure("mailto: link is malformed and could not be parsed.", element: @link)
|
|
30
|
+
next
|
|
27
31
|
end
|
|
32
|
+
|
|
33
|
+
missing = required_parameters.reject { |name| names.include?(name) }
|
|
34
|
+
next if missing.empty?
|
|
35
|
+
|
|
36
|
+
add_failure("mailto: link is missing required parameters: #{missing.join(", ")}", element: @link)
|
|
28
37
|
end
|
|
29
|
-
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def required_parameters
|
|
43
|
+
configured = @runner.options[:mailto_awesome]
|
|
44
|
+
names = configured[:required_parameters] || configured["required_parameters"] if configured.is_a?(Hash)
|
|
45
|
+
names = DEFAULT_REQUIRED_PARAMETERS if names.nil?
|
|
46
|
+
Array(names).map { |name| name.to_s.downcase }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def header_names(href)
|
|
50
|
+
# Nokogiri has already decoded &. A caller that passes the source
|
|
51
|
+
# text still has the entity, which RFC 6068 requires in HTML.
|
|
52
|
+
semantic = href.gsub("&", "&").gsub("<", "<").gsub(">", ">")
|
|
53
|
+
uri = URI.parse(semantic)
|
|
54
|
+
raise URI::InvalidURIError, semantic unless uri.is_a?(URI::MailTo)
|
|
55
|
+
|
|
56
|
+
Array(uri.headers).map { |name, _value| name.to_s.downcase }
|
|
57
|
+
end
|
|
30
58
|
end
|
|
31
59
|
end
|
|
32
60
|
end
|
metadata
CHANGED
|
@@ -1,132 +1,103 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: html-proofer-mailto_awesome
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 2.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- William Entriken
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
13
|
+
name: html-proofer
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
16
|
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
20
|
-
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - "~>"
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: 2.0.2
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: rake
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - "~>"
|
|
18
|
+
version: '5.0'
|
|
19
|
+
- - ">="
|
|
32
20
|
- !ruby/object:Gem::Version
|
|
33
|
-
version:
|
|
34
|
-
type: :
|
|
21
|
+
version: 5.0.4
|
|
22
|
+
type: :runtime
|
|
35
23
|
prerelease: false
|
|
36
24
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
25
|
requirements:
|
|
38
26
|
- - "~>"
|
|
39
27
|
- !ruby/object:Gem::Version
|
|
40
|
-
version:
|
|
28
|
+
version: '5.0'
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 5.0.4
|
|
41
32
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
33
|
+
name: logger
|
|
43
34
|
requirement: !ruby/object:Gem::Requirement
|
|
44
35
|
requirements:
|
|
45
|
-
- - "~>"
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '5.0'
|
|
48
36
|
- - ">="
|
|
49
37
|
- !ruby/object:Gem::Version
|
|
50
|
-
version:
|
|
38
|
+
version: '0'
|
|
51
39
|
type: :runtime
|
|
52
40
|
prerelease: false
|
|
53
41
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
42
|
requirements:
|
|
55
|
-
- - "~>"
|
|
56
|
-
- !ruby/object:Gem::Version
|
|
57
|
-
version: '5.0'
|
|
58
43
|
- - ">="
|
|
59
44
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
45
|
+
version: '0'
|
|
61
46
|
- !ruby/object:Gem::Dependency
|
|
62
|
-
name:
|
|
47
|
+
name: bundler
|
|
63
48
|
requirement: !ruby/object:Gem::Requirement
|
|
64
49
|
requirements:
|
|
65
|
-
- - "~>"
|
|
66
|
-
- !ruby/object:Gem::Version
|
|
67
|
-
version: '3.12'
|
|
68
50
|
- - ">="
|
|
69
51
|
- !ruby/object:Gem::Version
|
|
70
|
-
version:
|
|
52
|
+
version: '2.0'
|
|
71
53
|
type: :development
|
|
72
54
|
prerelease: false
|
|
73
55
|
version_requirements: !ruby/object:Gem::Requirement
|
|
74
56
|
requirements:
|
|
75
|
-
- - "~>"
|
|
76
|
-
- !ruby/object:Gem::Version
|
|
77
|
-
version: '3.12'
|
|
78
57
|
- - ">="
|
|
79
58
|
- !ruby/object:Gem::Version
|
|
80
|
-
version:
|
|
59
|
+
version: '2.0'
|
|
81
60
|
- !ruby/object:Gem::Dependency
|
|
82
|
-
name:
|
|
61
|
+
name: rake
|
|
83
62
|
requirement: !ruby/object:Gem::Requirement
|
|
84
63
|
requirements:
|
|
85
|
-
- - "~>"
|
|
86
|
-
- !ruby/object:Gem::Version
|
|
87
|
-
version: '6.1'
|
|
88
64
|
- - ">="
|
|
89
65
|
- !ruby/object:Gem::Version
|
|
90
|
-
version:
|
|
66
|
+
version: '13.0'
|
|
91
67
|
type: :development
|
|
92
68
|
prerelease: false
|
|
93
69
|
version_requirements: !ruby/object:Gem::Requirement
|
|
94
70
|
requirements:
|
|
95
|
-
- - "~>"
|
|
96
|
-
- !ruby/object:Gem::Version
|
|
97
|
-
version: '6.1'
|
|
98
71
|
- - ">="
|
|
99
72
|
- !ruby/object:Gem::Version
|
|
100
|
-
version:
|
|
73
|
+
version: '13.0'
|
|
101
74
|
- !ruby/object:Gem::Dependency
|
|
102
|
-
name:
|
|
75
|
+
name: rspec
|
|
103
76
|
requirement: !ruby/object:Gem::Requirement
|
|
104
77
|
requirements:
|
|
105
78
|
- - "~>"
|
|
106
79
|
- !ruby/object:Gem::Version
|
|
107
|
-
version: '
|
|
108
|
-
- - ">="
|
|
109
|
-
- !ruby/object:Gem::Version
|
|
110
|
-
version: 0.9.6
|
|
80
|
+
version: '3.12'
|
|
111
81
|
type: :development
|
|
112
82
|
prerelease: false
|
|
113
83
|
version_requirements: !ruby/object:Gem::Requirement
|
|
114
84
|
requirements:
|
|
115
85
|
- - "~>"
|
|
116
86
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
118
|
-
- - ">="
|
|
119
|
-
- !ruby/object:Gem::Version
|
|
120
|
-
version: 0.9.6
|
|
87
|
+
version: '3.12'
|
|
121
88
|
description: A custom html-proofer test that makes your mailto links awesome
|
|
122
89
|
email: github.com@phor.net
|
|
123
90
|
executables: []
|
|
124
91
|
extensions: []
|
|
125
92
|
extra_rdoc_files: []
|
|
126
93
|
files:
|
|
94
|
+
- ".editorconfig"
|
|
127
95
|
- ".github/FUNDING.yml"
|
|
96
|
+
- ".github/workflows/lint.yml"
|
|
128
97
|
- ".github/workflows/ruby.yml"
|
|
129
98
|
- ".gitignore"
|
|
99
|
+
- ".markdownlint.json"
|
|
100
|
+
- ".prettierignore"
|
|
130
101
|
- ".rspec"
|
|
131
102
|
- Gemfile
|
|
132
103
|
- Gemfile.lock
|
|
@@ -136,13 +107,17 @@ files:
|
|
|
136
107
|
- bin/console
|
|
137
108
|
- bin/setup
|
|
138
109
|
- html-proofer-mailto_awesome.gemspec
|
|
110
|
+
- lib/html-proofer-mailto_awesome.rb
|
|
139
111
|
- lib/html/proofer/mailto_awesome/version.rb
|
|
140
112
|
- lib/mailto_awesome.rb
|
|
141
113
|
homepage: https://github.com/fulldecent/html-proofer-mailto_awesome
|
|
142
114
|
licenses:
|
|
143
115
|
- MIT
|
|
144
|
-
metadata:
|
|
145
|
-
|
|
116
|
+
metadata:
|
|
117
|
+
bug_tracker_uri: https://github.com/fulldecent/html-proofer-mailto_awesome/issues
|
|
118
|
+
source_code_uri: https://github.com/fulldecent/html-proofer-mailto_awesome
|
|
119
|
+
homepage_uri: https://github.com/fulldecent/html-proofer-mailto_awesome
|
|
120
|
+
rubygems_mfa_required: 'true'
|
|
146
121
|
rdoc_options: []
|
|
147
122
|
require_paths:
|
|
148
123
|
- lib
|
|
@@ -150,15 +125,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
150
125
|
requirements:
|
|
151
126
|
- - ">="
|
|
152
127
|
- !ruby/object:Gem::Version
|
|
153
|
-
version:
|
|
128
|
+
version: 3.3.0
|
|
154
129
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
130
|
requirements:
|
|
156
131
|
- - ">="
|
|
157
132
|
- !ruby/object:Gem::Version
|
|
158
133
|
version: '0'
|
|
159
134
|
requirements: []
|
|
160
|
-
rubygems_version:
|
|
161
|
-
signing_key:
|
|
135
|
+
rubygems_version: 4.0.20
|
|
162
136
|
specification_version: 4
|
|
163
137
|
summary: Checker for mailto links
|
|
164
138
|
test_files: []
|