html-proofer-mailto_awesome 2.1.0 → 2.1.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6411236c394f40f47f399843d66e72fd0c23dbeff791b9f424b17b1d3109d00d
4
- data.tar.gz: aec40d5251f5ae89c1fb928a22d42c94a4838b0ec10c21ad4cb6701f877690fd
3
+ metadata.gz: d3c1456848f4430beff8ea44f6027c6ce37697f546bd18bedf8869343b77957b
4
+ data.tar.gz: 46da1f7c086826914e19521fc66f536b41487d00a04021302d2f07d073a4d423
5
5
  SHA512:
6
- metadata.gz: 1656ce1159562e5a4247f852f69290f8442dea492d842dcbc82e79c828edb9a5e18d36b71a8b6474c63c8d3bc4d69609ffd17efa752f204a75a58972cd3bd85d
7
- data.tar.gz: e7d4983774757825b40c346932b736790a2f1553027f4995c50cc79902043523f7433dab3c2e963ab948e15f85a095223d7a9ee33110b1e8a1f5bc61ec17ec1b
6
+ metadata.gz: aabc47a3e8db1c5857e092236022cd5148a932dadfcb5cc1a478037d4d18aef1c5a36a5df88b7e6e200b3ee18300ca71f6857d70ff5944c559fae523efa1ae4f
7
+ data.tar.gz: 9f36a570bc8c78d5b1687d00d1efb8ac554ea6cf8fa914dc5abfd8113e592e29219f747c344c16c41b86a21be8ea9adac4f2b8c4e771251190d7e3677d17c49b
@@ -0,0 +1,154 @@
1
+ # Release
2
+ #
3
+ # Open or update the release pull request. After that pull request is merged,
4
+ # run the test matrix, tag v1.2.3, push the gem, and open the GitHub Release.
5
+ #
6
+ # Release Please uses the Ruby strategy in release-please-config.json. The
7
+ # manifest .release-please-manifest.json is the last released version. The
8
+ # bootstrap SHA is the 2.1.0 commit, which is already on RubyGems and has no
9
+ # v2.1.0 tag. Commits after that SHA are the next release.
10
+ #
11
+ # skip-github-release keeps the tag off the release pull request. This job
12
+ # creates the tag with rake release, after the tests pass. Bundler tags
13
+ # v1.2.3. Release Please recognizes that shape. A tag shaped like 1.2.3 does
14
+ # not count. The existing tag 2.0.0 is that second shape.
15
+ #
16
+ # RubyGems trusted publishing names this workflow file release.yml and leaves
17
+ # the environment empty. The publish job asks GitHub for an OIDC token
18
+ # (id-token: write). rubygems/release-gem exchanges that token for a
19
+ # short-lived RubyGems credential and runs bundle exec rake release.
20
+ # https://guides.rubygems.org/trusted-publishing/
21
+ #
22
+ # The release pull request is opened with the workflow token. GitHub does not
23
+ # start the test workflow on that pull request. The test job below is the run
24
+ # that has to pass before the gem is pushed.
25
+ #
26
+ # One-time setup
27
+ # 1. On the gem page, Trusted publishers, create a publisher:
28
+ # owner fulldecent, repository html-proofer-mailto_awesome,
29
+ # workflow filename release.yml, environment empty.
30
+ # 2. Repository settings, Actions, General, Workflow permissions: read and
31
+ # write, and allow GitHub Actions to create and approve pull requests.
32
+
33
+ name: Release
34
+
35
+ on:
36
+ push:
37
+ branches: ["main"]
38
+ workflow_dispatch:
39
+ inputs:
40
+ tag:
41
+ description: Tag to publish, for example v1.2.3. Leave empty to open or update the release pull request only.
42
+ required: false
43
+ type: string
44
+
45
+ permissions:
46
+ contents: write
47
+ issues: write
48
+ pull-requests: write
49
+
50
+ jobs:
51
+ propose:
52
+ name: Open or update the release pull request
53
+ if: github.event_name == 'push' || inputs.tag == ''
54
+ runs-on: ubuntu-latest
55
+ outputs:
56
+ pr: ${{ steps.merged.outputs.pr }}
57
+ tag_name: ${{ steps.merged.outputs.tag_name }}
58
+ steps:
59
+ - name: Open the release pull request
60
+ uses: googleapis/release-please-action@v5
61
+ with:
62
+ skip-github-release: true
63
+
64
+ - name: Find a merged release pull request
65
+ id: merged
66
+ if: github.event_name == 'push'
67
+ env:
68
+ GH_TOKEN: ${{ github.token }}
69
+ run: |
70
+ found=$(gh api "repos/$GITHUB_REPOSITORY/commits/$GITHUB_SHA/pulls" --jq '
71
+ .[] | select(.merged_at != null and any(.labels[]; .name == "autorelease: pending"))
72
+ | "\(.number) v\(.title | capture("release (?<v>[0-9]+[.][0-9]+[.][0-9]+)").v)"' | head -n 1)
73
+ if [ -n "$found" ]; then
74
+ read -r pr tag <<< "$found"
75
+ echo "pr=$pr" >> "$GITHUB_OUTPUT"
76
+ echo "tag_name=$tag" >> "$GITHUB_OUTPUT"
77
+ fi
78
+
79
+ test:
80
+ name: Test
81
+ needs: propose
82
+ if: |
83
+ always() &&
84
+ (needs.propose.result == 'success' || needs.propose.result == 'skipped') &&
85
+ (needs.propose.outputs.tag_name != '' ||
86
+ (github.event_name == 'workflow_dispatch' && inputs.tag != ''))
87
+ uses: ./.github/workflows/ruby.yml
88
+
89
+ publish:
90
+ name: Publish gem
91
+ needs: [propose, test]
92
+ if: |
93
+ always() &&
94
+ needs.test.result == 'success' &&
95
+ (needs.propose.outputs.tag_name != '' ||
96
+ (github.event_name == 'workflow_dispatch' && inputs.tag != ''))
97
+ runs-on: ubuntu-latest
98
+ permissions:
99
+ contents: write
100
+ pull-requests: write
101
+ id-token: write
102
+ steps:
103
+ - name: Check out this commit
104
+ uses: actions/checkout@v7
105
+ with:
106
+ persist-credentials: false
107
+
108
+ - name: Set up Ruby
109
+ uses: ruby/setup-ruby@v1
110
+ with:
111
+ ruby-version: "3.4"
112
+ bundler-cache: true
113
+
114
+ - name: Require version.rb to match the tag
115
+ id: tag
116
+ env:
117
+ TAG: ${{ inputs.tag || needs.propose.outputs.tag_name }}
118
+ run: |
119
+ case "$TAG" in
120
+ v*.*.*) ;;
121
+ *) echo "tag must look like v1.2.3" >&2; exit 1 ;;
122
+ esac
123
+ file=$(ruby -e 'load "lib/html/proofer/mailto_awesome/version.rb"; print MailtoAwesome::VERSION')
124
+ version="${TAG#v}"
125
+ if [ "$file" != "$version" ]; then
126
+ echo "version.rb is ${file}; tag version is ${version}" >&2
127
+ exit 1
128
+ fi
129
+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
130
+
131
+ # rake release tags v1.2.3, pushes that tag, and pushes the gem.
132
+ - name: Push the gem
133
+ uses: rubygems/release-gem@v1
134
+
135
+ - name: Publish the GitHub Release
136
+ env:
137
+ GH_TOKEN: ${{ github.token }}
138
+ TAG: ${{ steps.tag.outputs.tag }}
139
+ run: |
140
+ gh release create "$TAG" \
141
+ --repo "$GITHUB_REPOSITORY" \
142
+ --target "$GITHUB_SHA" \
143
+ --title "$TAG" \
144
+ --generate-notes \
145
+ --latest
146
+
147
+ - name: Mark the release pull request tagged
148
+ if: needs.propose.outputs.pr != ''
149
+ env:
150
+ GH_TOKEN: ${{ github.token }}
151
+ PR: ${{ needs.propose.outputs.pr }}
152
+ run: |
153
+ gh api -X DELETE "repos/$GITHUB_REPOSITORY/issues/$PR/labels/autorelease:%20pending"
154
+ gh api "repos/$GITHUB_REPOSITORY/issues/$PR/labels" -f "labels[]=autorelease: tagged"
@@ -8,6 +8,7 @@ on:
8
8
  branches: ["main"]
9
9
  pull_request:
10
10
  branches: ["**"]
11
+ workflow_call:
11
12
 
12
13
  permissions:
13
14
  contents: read
data/.gitignore CHANGED
@@ -15,3 +15,6 @@
15
15
 
16
16
  # The lint workflow runs npx, which can leave a local install tree.
17
17
  node_modules/
18
+
19
+ # gem build writes the package in the working directory. rake release writes pkg/.
20
+ *.gem
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "2.1.1"
3
+ }
data/CHANGELOG.md ADDED
@@ -0,0 +1,8 @@
1
+ # Changelog
2
+
3
+ ## [2.1.1](https://github.com/fulldecent/html-proofer-mailto_awesome/compare/v2.1.0...v2.1.1) (2026-10-09)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * check a mailto href that has padding around it ([0da97c5](https://github.com/fulldecent/html-proofer-mailto_awesome/commit/0da97c5e3102f01f6a33bf82feb5a006df334f72))
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- html-proofer-mailto_awesome (2.1.0)
4
+ html-proofer-mailto_awesome (2.1.1)
5
5
  html-proofer (~> 5.0, >= 5.0.4)
6
6
  logger
7
7
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # html-proofer-mailto_awesome
2
2
 
3
- ![Gem](https://img.shields.io/gem/v/html-proofer-mailto_awesome) [![Test](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/ruby.yml/badge.svg)](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/ruby.yml) [![Lint](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/lint.yml/badge.svg)](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/lint.yml)
3
+ ![Gem](https://img.shields.io/gem/v/html-proofer-mailto_awesome) [![Test](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/ruby.yml/badge.svg)](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/ruby.yml) [![Lint](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/lint.yml/badge.svg)](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/lint.yml) [![Release](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/release.yml/badge.svg)](https://github.com/fulldecent/html-proofer-mailto_awesome/actions/workflows/release.yml)
4
4
 
5
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
6
 
@@ -70,7 +70,7 @@ Run it with Bundler so the gem is on the load path:
70
70
  bundle exec rake
71
71
  ```
72
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.
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. Spaces and ASCII control characters at either end of the attribute are ignored. [URL parsing](https://url.spec.whatwg.org/#url-parsing) removes those characters before it reads the scheme, so a padded `mailto:support@example.com` is still checked.
74
74
 
75
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
76
 
@@ -111,22 +111,24 @@ npx markdownlint-cli@latest --fix "**/*.md" --ignore node_modules
111
111
 
112
112
  ## Releasing
113
113
 
114
- ```sh
115
- gem install bump
116
- bump patch # or minor, or major
117
- rm -f html-proofer-mailto_awesome-*.gem
118
- gem build html-proofer-mailto_awesome.gemspec
119
- gem push html-proofer-mailto_awesome-*.gem
120
- ```
114
+ Use `fix:`, `feat:`, or `BREAKING CHANGE:` in commit messages on `main`. A commit whose message starts with `fix:` opens or updates a release pull request that bumps the patch version. `feat:` bumps the minor version. `BREAKING CHANGE:` bumps the major version. One release pull request collects every such commit since the last release. A commit with any other prefix, including `chore:` and `docs:`, does not open that pull request.
115
+
116
+ The [release workflow](.github/workflows/release.yml) uses [release-please](https://github.com/googleapis/release-please) with the Ruby strategy. The configuration is [release-please-config.json](release-please-config.json). [.release-please-manifest.json](.release-please-manifest.json) is the last released version, which is 2.1.0. Merging the release pull request is the release. That pull request sets the version in [lib/html/proofer/mailto_awesome/version.rb](lib/html/proofer/mailto_awesome/version.rb) and in the path spec in [Gemfile.lock](Gemfile.lock), and it writes [CHANGELOG.md](CHANGELOG.md).
117
+
118
+ The publish job then runs the same Ruby matrix as [`.github/workflows/ruby.yml`](.github/workflows/ruby.yml). After those tests pass, it tags `v1.2.3`, pushes that tag, and pushes the gem. The tag is the version Bundler's `rake release` task writes. Release Please reads tags of that shape. The older tag `2.0.0` has no `v`, so it is not a Release Please version. `bootstrap-sha` in the config is commit `b4c37c1`, the commit already published as 2.1.0. The next release is made of commits after that SHA.
119
+
120
+ The release pull request is opened with the workflow token. GitHub does not start [`.github/workflows/ruby.yml`](.github/workflows/ruby.yml) on a pull request opened that way. The publish job's test run is the one that gates the gem.
121
+
122
+ RubyGems.org still requires MFA for this gem (`rubygems_mfa_required`). Publishing from GitHub Actions follows [RubyGems trusted publishing](https://guides.rubygems.org/trusted-publishing/). The gem's trusted publisher names the workflow file `release.yml` and leaves the environment empty. GitHub's OIDC token is exchanged for a short-lived RubyGems credential. No RubyGems API key is stored in this repository.
121
123
 
122
- Rubygems requires MFA for this gem (`rubygems_mfa_required`).
124
+ Before the first automated publish, create that trusted publisher. On the gem page, open Trusted publishers and create one with owner `fulldecent`, repository `html-proofer-mailto_awesome`, and workflow filename `release.yml`. Leave the environment empty. In the GitHub repository settings, under Actions, General, Workflow permissions, select read and write permissions and check "Allow GitHub Actions to create and approve pull requests". This repository already has those two settings.
123
125
 
124
126
  ## Maintenance
125
127
 
126
128
  Do this every month or so:
127
129
 
128
130
  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.
131
+ 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`, `googleapis/release-please-action`, and `rubygems/release-gem` are not in that organization. Read their changelogs before moving the tag.
130
132
  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
133
  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
134
 
@@ -138,3 +140,4 @@ Do this every month or so:
138
140
  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
141
  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
142
  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.
143
+ 1. Releases follow [release-please](https://github.com/googleapis/release-please) in manifest mode, with the [Ruby strategy](https://github.com/googleapis/release-please/blob/main/docs/customizing.md). Commit messages follow [Conventional Commits 1.0.0](https://www.conventionalcommits.org/en/v1.0.0/). The release pull request is the review gate. [semantic-release](https://github.com/semantic-release/semantic-release) commits onto the default branch and assumes Node. Publishing the gem follows [RubyGems trusted publishing](https://guides.rubygems.org/trusted-publishing/) and [`rubygems/release-gem`](https://github.com/rubygems/release-gem). The trusted publisher names `release.yml` and leaves the environment empty. `rake release` creates the `v1.2.3` tag after the tests pass, because a tag created earlier would exist while the tests can still fail. A tag created by `GITHUB_TOKEN` does not start another workflow ([GitHub docs](https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow)), so the publish job is in this same workflow. The shape of the workflow follows [php-template](https://github.com/fulldecent/php-template)'s release workflow: Release Please opens the pull request, and the publish job creates the tag. Delta: this job pushes a gem with trusted publishing, and the version lives in `version.rb` because the Ruby strategy updates that file. php-template takes the version from the tag alone.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MailtoAwesome
4
- VERSION = "2.1.0"
4
+ VERSION = "2.1.1"
5
5
  end
@@ -15,13 +15,21 @@ module HTMLProofer
15
15
  class MailtoAwesome < HTMLProofer::Check
16
16
  DEFAULT_REQUIRED_PARAMETERS = ["subject", "body"].freeze
17
17
 
18
+ # WHATWG URL parsing removes leading and trailing C0 controls and spaces
19
+ # before it reads the scheme. " mailto:support@example.com" is a mailto link.
20
+ # https://url.spec.whatwg.org/#url-parsing
21
+ LEADING_OR_TRAILING_URL_SPACE = /\A[\x00-\x1F ]+|[\x00-\x1F ]+\z/
22
+
18
23
  def run
19
24
  @html.css("a").each do |node|
20
25
  @link = create_element(node)
21
26
  next if @link.ignore?
22
27
 
23
28
  href = node["href"]
24
- next unless href.is_a?(String) && href.match?(/\Amailto:/i)
29
+ next unless href.is_a?(String)
30
+
31
+ href = href.gsub(LEADING_OR_TRAILING_URL_SPACE, "")
32
+ next unless href.match?(/\Amailto:/i)
25
33
 
26
34
  begin
27
35
  names = header_names(href)
@@ -0,0 +1,11 @@
1
+ {
2
+ "bootstrap-sha": "b4c37c17fee1ec30cb127daad3f5c437f1c341db",
3
+ "packages": {
4
+ ".": {
5
+ "release-type": "ruby",
6
+ "package-name": "html-proofer-mailto_awesome",
7
+ "include-component-in-tag": false,
8
+ "version-file": "lib/html/proofer/mailto_awesome/version.rb"
9
+ }
10
+ }
11
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-proofer-mailto_awesome
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Entriken
@@ -94,11 +94,14 @@ files:
94
94
  - ".editorconfig"
95
95
  - ".github/FUNDING.yml"
96
96
  - ".github/workflows/lint.yml"
97
+ - ".github/workflows/release.yml"
97
98
  - ".github/workflows/ruby.yml"
98
99
  - ".gitignore"
99
100
  - ".markdownlint.json"
100
101
  - ".prettierignore"
102
+ - ".release-please-manifest.json"
101
103
  - ".rspec"
104
+ - CHANGELOG.md
102
105
  - Gemfile
103
106
  - Gemfile.lock
104
107
  - LICENSE
@@ -110,6 +113,7 @@ files:
110
113
  - lib/html-proofer-mailto_awesome.rb
111
114
  - lib/html/proofer/mailto_awesome/version.rb
112
115
  - lib/mailto_awesome.rb
116
+ - release-please-config.json
113
117
  homepage: https://github.com/fulldecent/html-proofer-mailto_awesome
114
118
  licenses:
115
119
  - MIT
@@ -132,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
136
  - !ruby/object:Gem::Version
133
137
  version: '0'
134
138
  requirements: []
135
- rubygems_version: 4.0.20
139
+ rubygems_version: 3.6.9
136
140
  specification_version: 4
137
141
  summary: Checker for mailto links
138
142
  test_files: []