html-merge 7.1.20 → 8.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
- checksums.yaml.gz.sig +0 -0
- data/README.md +100 -51
- data/lib/html/merge/crispr_adapter.rb +4 -4
- data/lib/html/merge/file_analysis.rb +3 -3
- data/lib/html/merge/provider.rb +65 -64
- data/lib/html/merge/version.rb +1 -1
- data/lib/html/merge.rb +4 -4
- data.tar.gz.sig +0 -0
- metadata +14 -14
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ddc362ab2109837742028ad237fa31695c74e6ba2f9912d31c653982b237015a
|
|
4
|
+
data.tar.gz: 9b30652fad60b240087bdf01fd6c0c0547436517e9b332bddea1ad999f7d806c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f5f9daf4e4680a2a64ccc768c24e456687eee6fc3c18e7ea6ad87563d1281b17a4b8319ed6de15248bcecfad96b69e0ab66244d87d407151f250201d24b422df
|
|
7
|
+
data.tar.gz: 3f05ac67b753b21873515a98249321a4742a245568fd51210efe8b5b54385818cb610ddc3eb3736052d9959909047db09da2cdcc2881fcb4875387655890f5c3
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
data/README.md
CHANGED
|
@@ -2,22 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
# 💎 Html::Merge
|
|
4
4
|
|
|
5
|
-
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CI Current][🚎11-c-wfi]][🚎11-c-wf]
|
|
5
|
+
[![Version][👽versioni]][👽version] [![Ruby Users Forum][✉️ruby-forum-top-img]][✉️ruby-forum] [![GitHub tag (latest SemVer)][⛳️tag-img]][⛳️tag] [![License: MIT][📄license-img]][📄license] [![Total downloads][👽dl-ranki]][👽dl-rank] [![CodeCov Test Coverage][🏀codecovi]][🏀codecov] [![Coveralls Test Coverage][🏀coveralls-img]][🏀coveralls] [![QLTY Test Coverage][🏀qlty-covi]][🏀qlty-cov] [![QLTY Maintainability][🏀qlty-mnti]][🏀qlty-mnt] [![CI Current][🚎11-c-wfi]][🚎11-c-wf] [![CI Test Coverage][🚎2-cov-wfi]][🚎2-cov-wf]
|
|
6
6
|
|
|
7
7
|
`if ci_badges.map(&:color).detect { it != "green"}` ☝️ [let me know on Discord][✉️discord-invite] or [RubyForum][✉️ruby-forum], as I may have missed the notification.
|
|
8
8
|
|
|
9
|
-
---
|
|
10
|
-
|
|
11
9
|
`if ci_badges.map(&:color).all? { it == "green"}` 👇️ send money so I can do more of this. FLOSS maintenance is now my full-time job.
|
|
12
10
|
|
|
13
|
-
[![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
14
|
-
|
|
15
|
-
<details markdown="1">
|
|
16
|
-
<summary>👣 How will this project approach the September 2025 hostile takeover of RubyGems? 🚑️</summary>
|
|
17
|
-
|
|
18
|
-
I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-takeover-of-rubygems-my-thoughts-5hlo).
|
|
11
|
+
[![OpenCollective Backers][🖇osc-backers-i]][🖇osc-backers] [![OpenCollective Sponsors][🖇osc-sponsors-i]][🖇osc-sponsors] [![Sponsor Me on Github][🖇sponsor-img]][🖇sponsor] [![Liberapay Goal Progress][⛳liberapay-img]][⛳liberapay] [![Donate on PayPal][🖇paypal-img]][🖇paypal] [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
<!-- kettle-sponsors:shields:start -->
|
|
14
|
+
<a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/github.svg" alt="services: GitHub"></a> <a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/healthsherpa.svg" alt="sponsor: HealthSherpa"></a> <a href="#corporate-sponsorship"><img src="https://logos.galtzo.com/assets/images/sponsors/shield/microsoft.svg" alt="compute: Microsoft"></a>
|
|
15
|
+
<!-- kettle-sponsors:shields:end -->
|
|
21
16
|
|
|
22
17
|
## 🌻 Synopsis <a href="https://discord.gg/3qme4XHNKN"><img alt="Galtzo FLOSS Logo by Aboling0, CC BY-SA 4.0" src="https://logos.galtzo.com/assets/images/galtzo-floss/avatar-128px.svg" width="8%" align="right"/></a> <a href="https://ruby-toolbox.com"><img alt="ruby-lang Logo, Yukihiro Matsumoto, Ruby Visual Identity Team, CC BY-SA 2.5" src="https://logos.galtzo.com/assets/images/ruby-lang/avatar-128px.svg" width="8%" align="right"/></a>
|
|
23
18
|
|
|
@@ -25,6 +20,54 @@ Html::Merge provides TreeHaver-backed HTML parsing and structural analysis for
|
|
|
25
20
|
the StructuredMerge Ruby family, including feature profiles and YARD content
|
|
26
21
|
wrapper repair helpers.
|
|
27
22
|
|
|
23
|
+
## ✨ Installation
|
|
24
|
+
|
|
25
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
26
|
+
|
|
27
|
+
```console
|
|
28
|
+
bundle add html-merge
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
32
|
+
|
|
33
|
+
```console
|
|
34
|
+
gem install html-merge
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## ⚙️ Configuration
|
|
38
|
+
|
|
39
|
+
HTML parsing is registered through TreeHaver. The gem currently supports the
|
|
40
|
+
HTML dialect and its configured Kreuzberg language-pack backend; inspect
|
|
41
|
+
`Html::Merge.html_plan_context` before selecting a backend in a host merge
|
|
42
|
+
pipeline. No global initializer is required.
|
|
43
|
+
|
|
44
|
+
## 🔧 Basic Usage
|
|
45
|
+
|
|
46
|
+
Parse and inspect HTML through the module API:
|
|
47
|
+
|
|
48
|
+
```ruby
|
|
49
|
+
require "html/merge"
|
|
50
|
+
|
|
51
|
+
result = Html::Merge.parse_html("<main><h1>Hello</h1></main>")
|
|
52
|
+
raise result[:diagnostics].inspect unless result[:ok]
|
|
53
|
+
|
|
54
|
+
puts result.dig(:analysis, :nodes)
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Use `Html::Merge.html_plan_context` to advertise the available backend and
|
|
58
|
+
`Html::Merge.ensure_yard_content_wrapper` when repairing YARD-generated HTML.
|
|
59
|
+
|
|
60
|
+
## 🏢 Corporate Sponsorship
|
|
61
|
+
|
|
62
|
+
<!-- kettle-sponsors:cards:start -->
|
|
63
|
+
<a href="https://github.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/github.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/github.svg" align="top" alt="Sponsor: GitHub - Copilot Max"></picture></a> <a href="https://healthsherpa.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/healthsherpa.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/healthsherpa.svg" align="top" alt="Sponsor: HealthSherpa - GitHub Sponsors => @pboling (maintainer)"></picture></a> <a href="https://opensource.microsoft.com"><picture><source media="(max-width: 600px)" srcset="https://logos.galtzo.com/assets/images/sponsors/phone/microsoft.svg"><img src="https://logos.galtzo.com/assets/images/sponsors/microsoft.svg" align="top" alt="Sponsor: Microsoft - Azure compute resources"></picture></a>
|
|
64
|
+
|
|
65
|
+
<sub>Create sponsorship badges for your project with [kettle-sponsors](https://github.com/kettle-dev/kettle-sponsors).</sub>
|
|
66
|
+
<!-- kettle-sponsors:cards:end -->
|
|
67
|
+
|
|
68
|
+
**If you're working in a company that's making significant use of structuredmerge tools we'd
|
|
69
|
+
appreciate it if you suggest to your company to become a structuredmerge sponsor.**
|
|
70
|
+
|
|
28
71
|
## 💡 Info you can shake a stick at
|
|
29
72
|
|
|
30
73
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
@@ -33,7 +76,7 @@ wrapper repair helpers.
|
|
|
33
76
|
| Support & Community | [![Join Me on Daily.dev's RubyFriends][✉️ruby-friends-img]][✉️ruby-friends] [![Get help from RubyForum][✉️ruby-forum-img]][✉️ruby-forum] [![Live Chat on Discord][✉️discord-invite-img-ftb]][✉️discord-invite] [![Get help from me on Upwork][👨🏼🏫expsup-upwork-img]][👨🏼🏫expsup-upwork] [![Get help from me on Codementor][👨🏼🏫expsup-codementor-img]][👨🏼🏫expsup-codementor] |
|
|
34
77
|
| Source | [![Source on GitLab.com][📜src-gl-img]][📜src-gl] [![Source on CodeBerg.org][📜src-cb-img]][📜src-cb] [![Source on GitHub.com][📜src-gh-img]][📜src-gh] [![The best SHA: dQw4w9WgXcQ!][🧮kloc-img]][🧮kloc] |
|
|
35
78
|
| Documentation | [![Current release on RubyDoc.info][📜docs-cr-rd-img]][🚎yard-current] [![YARD on Galtzo.com][📜docs-head-rd-img]][🚎yard-head] [![Maintainer Blog][🚂maint-blog-img]][🚂maint-blog] [![GitLab Wiki][📜gl-wiki-img]][📜gl-wiki] [![GitHub Wiki][📜gh-wiki-img]][📜gh-wiki] |
|
|
36
|
-
| Compliance | [![License: MIT][📄license-img]][📄license] [![Apache license compatibility: Category A][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant
|
|
79
|
+
| Compliance | [![License: MIT][📄license-img]][📄license] [![Apache license compatibility: Category A][📄license-compat-img]][📄license-compat] [![📄ilo-declaration-img]][📄ilo-declaration] [![Security Policy][🔐security-img]][🔐security] [![Contributor Covenant 3.0][🪇conduct-img]][🪇conduct] [![SemVer 2.0.0][📌semver-img]][📌semver] |
|
|
37
80
|
| Style | [![Enforced Code Style Linter][💎rlts-img]][💎rlts] [![Keep-A-Changelog 1.0.0][📗keep-changelog-img]][📗keep-changelog] [![Gitmoji Commits][📌gitmoji-img]][📌gitmoji] [![Compatibility appraised by: appraisal2][💎appraisal2-img]][💎appraisal2] |
|
|
38
81
|
| Maintainer 🎖️ | [![Follow Me on LinkedIn][💖🖇linkedin-img]][💖🖇linkedin] [![Follow Me on Ruby.Social][💖🐘ruby-mast-img]][💖🐘ruby-mast] [![Follow Me on Bluesky][💖🦋bluesky-img]][💖🦋bluesky] [![Contact Maintainer][🚂maint-contact-img]][🚂maint-contact] [![My technical writing][💖💁🏼♂️devto-img]][💖💁🏼♂️devto] |
|
|
39
82
|
| `...` 💖 | [![Find Me on WellFound:][💖✌️wellfound-img]][💖✌️wellfound] [![Find Me on CrunchBase][💖💲crunchbase-img]][💖💲crunchbase] [![My LinkTree][💖🌳linktree-img]][💖🌳linktree] [![More About Me][💖💁🏼♂️aboutme-img]][💖💁🏼♂️aboutme] [🧊][💖🧊berg] [🐙][💖🐙hub] [🛖][💖🛖hut] [🧪][💖🧪lab] |
|
|
@@ -43,7 +86,7 @@ wrapper repair helpers.
|
|
|
43
86
|
The gem's declared runtime compatibility floor is MRI Ruby 3.2.0+, with concordant releases of JRuby and TruffleRuby.
|
|
44
87
|
CI workflows and Appraisals are generated for MRI Ruby 3.2.0+.
|
|
45
88
|
The current MRI CI lane runs on Linux and macOS.
|
|
46
|
-
The test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml`.
|
|
89
|
+
The test floor is configured by `ruby.test_minimum` in `.structuredmerge/kettle-jem.yml`.
|
|
47
90
|
When it is higher than the runtime floor, older runtime-compatible Rubies are
|
|
48
91
|
not covered by the generated CI or Appraisal matrix.
|
|
49
92
|
|
|
@@ -67,43 +110,6 @@ The _amazing_ test matrix is powered by the kettle-dev stack.
|
|
|
67
110
|
|
|
68
111
|
</details>
|
|
69
112
|
|
|
70
|
-
## ✨ Installation
|
|
71
|
-
|
|
72
|
-
Install the gem and add to the application's Gemfile by executing:
|
|
73
|
-
|
|
74
|
-
```console
|
|
75
|
-
bundle add html-merge
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
79
|
-
|
|
80
|
-
```console
|
|
81
|
-
gem install html-merge
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
## ⚙️ Configuration
|
|
85
|
-
|
|
86
|
-
HTML parsing is registered through TreeHaver. The gem currently supports the
|
|
87
|
-
HTML dialect and its configured Kreuzberg language-pack backend; inspect
|
|
88
|
-
`Html::Merge.html_plan_context` before selecting a backend in a host merge
|
|
89
|
-
pipeline. No global initializer is required.
|
|
90
|
-
|
|
91
|
-
## 🔧 Basic Usage
|
|
92
|
-
|
|
93
|
-
Parse and inspect HTML through the module API:
|
|
94
|
-
|
|
95
|
-
```ruby
|
|
96
|
-
require "html/merge"
|
|
97
|
-
|
|
98
|
-
result = Html::Merge.parse_html("<main><h1>Hello</h1></main>")
|
|
99
|
-
raise result[:diagnostics].inspect unless result[:ok]
|
|
100
|
-
|
|
101
|
-
puts result.dig(:analysis, :nodes)
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Use `Html::Merge.html_plan_context` to advertise the available backend and
|
|
105
|
-
`Html::Merge.ensure_yard_content_wrapper` when repairing YARD-generated HTML.
|
|
106
|
-
|
|
107
113
|
## 🔐 Security
|
|
108
114
|
|
|
109
115
|
See [SECURITY.md][🔐security].
|
|
@@ -117,6 +123,8 @@ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you m
|
|
|
117
123
|
|
|
118
124
|
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
119
125
|
|
|
126
|
+
Want to contribute with AI coding agents? This project is developed with [Cloudroom][🖇cloudroom] and ships an `AGENTS.md` with repo conventions so agents can jump straight in. Signing up with [my referral link][🖇cloudroom] also supports ongoing maintenance at no extra cost to you.
|
|
127
|
+
|
|
120
128
|
## 📌 Versioning
|
|
121
129
|
|
|
122
130
|
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
@@ -148,9 +156,35 @@ See [CHANGELOG.md][📌changelog] for a list of releases.
|
|
|
148
156
|
The gem is available as open source under the terms of
|
|
149
157
|
the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.md) [![License: MIT][📄license-img]][📄license-ref].
|
|
150
158
|
|
|
159
|
+
### Please give the project a star ⭐ ♥.
|
|
160
|
+
|
|
161
|
+
Many parts of this project are actively managed by a [kettle-jem](https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/kettle-jem) smart template utilizing [StructuredMerge.org](https://structuredmerge.org) merge contracts.
|
|
162
|
+
|
|
163
|
+
If this project helps you, please consider supporting the maintainer. This is not gated on the project's license; it appears in every README:
|
|
164
|
+
|
|
165
|
+
[![Sponsor kettle-dev/html-merge on Open Source Collective][🖇osc-all-bottom-img]][🖇osc] 💌 [![Sponsor me on GitHub Sponsors][🖇sponsor-bottom-img]][🖇sponsor] 💌 [![Sponsor me on Liberapay][⛳liberapay-bottom-img]][⛳liberapay] 💌 [![Donate on PayPal][🖇paypal-bottom-img]][🖇paypal] 💌 [![Buy me a coffee][🖇buyme-small-img]][🖇buyme] 💌 [![Donate at ko-fi.com][🖇kofi-img]][🖇kofi]
|
|
166
|
+
|
|
167
|
+
I use [Cloudroom][🖇cloudroom], an agentic AI coding environment, every day. It's the first AI product that made me say "shut up and take my money."
|
|
168
|
+
If you sign up with [my referral link][🖇cloudroom], I receive a share of your subscription for as long as you stay subscribed, at no extra cost to you.
|
|
169
|
+
|
|
170
|
+
[🖇cloudroom]: https://go.cloudroom.dev/u9f53f181a
|
|
171
|
+
|
|
172
|
+
Thanks for RTFM. ☺️
|
|
173
|
+
|
|
151
174
|
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
152
175
|
[⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
|
|
153
176
|
[⛳liberapay]: https://liberapay.com/pboling/donate
|
|
177
|
+
[🖇osc-all-img]: https://img.shields.io/opencollective/all/kettle-dev
|
|
178
|
+
[🖇osc-sponsors-img]: https://img.shields.io/opencollective/sponsors/kettle-dev
|
|
179
|
+
[🖇osc-backers-img]: https://img.shields.io/opencollective/backers/kettle-dev
|
|
180
|
+
[🖇osc-backers]: https://opencollective.com/kettle-dev#backer
|
|
181
|
+
[🖇osc-backers-i]: https://opencollective.com/kettle-dev/backers/badge.svg?style=flat
|
|
182
|
+
[🖇osc-sponsors]: https://opencollective.com/kettle-dev#sponsor
|
|
183
|
+
[🖇osc-sponsors-i]: https://opencollective.com/kettle-dev/sponsors/badge.svg?style=flat
|
|
184
|
+
[🖇osc-all-bottom-img]: https://img.shields.io/opencollective/all/kettle-dev?style=for-the-badge
|
|
185
|
+
[🖇osc-sponsors-bottom-img]: https://img.shields.io/opencollective/sponsors/kettle-dev?style=for-the-badge
|
|
186
|
+
[🖇osc-backers-bottom-img]: https://img.shields.io/opencollective/backers/kettle-dev?style=for-the-badge
|
|
187
|
+
[🖇osc]: https://opencollective.com/kettle-dev
|
|
154
188
|
[🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
|
|
155
189
|
[🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
|
|
156
190
|
[🖇sponsor]: https://github.com/sponsors/pboling
|
|
@@ -171,6 +205,7 @@ the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.
|
|
|
171
205
|
[✉️ruby-forum-top-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=flat&logo=discourse&label=Ruby%20Users%20Forum
|
|
172
206
|
[✉️ruby-forum-img]: https://img.shields.io/discourse/topics?server=https%3A%2F%2Fwww.rubyforum.org&style=for-the-badge&logo=discourse&label=Ruby%20Users%20Forum
|
|
173
207
|
[✉️ruby-forum]: https://www.rubyforum.org/tag/structuredmerge
|
|
208
|
+
|
|
174
209
|
[✇bundle-group-pattern]: https://gist.github.com/pboling/4564780
|
|
175
210
|
[⛳️gem-namespace]: https://github.com/structuredmerge/structuredmerge-ruby/tree/main/gems/html-merge
|
|
176
211
|
[⛳️namespace-img]: https://img.shields.io/badge/namespace-Html::Merge-3C2D2D.svg?style=square&logo=ruby&logoColor=white
|
|
@@ -224,6 +259,16 @@ the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.
|
|
|
224
259
|
[👽dl-ranki]: https://img.shields.io/gem/dt/html-merge.svg
|
|
225
260
|
[👽version]: https://clickgems.clickhouse.com/dashboard/html-merge
|
|
226
261
|
[👽versioni]: https://img.shields.io/gem/v/html-merge.svg
|
|
262
|
+
[🏀qlty-mnt]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby
|
|
263
|
+
[🏀qlty-mnti]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby/maintainability.svg
|
|
264
|
+
[🏀qlty-cov]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby/metrics/code?sort=coverageRating
|
|
265
|
+
[🏀qlty-covi]: https://qlty.sh/gh/structuredmerge/projects/structuredmerge-ruby/coverage.svg
|
|
266
|
+
[🏀codecov]: https://codecov.io/gh/structuredmerge/structuredmerge-ruby
|
|
267
|
+
[🏀codecovi]: https://codecov.io/gh/structuredmerge/structuredmerge-ruby/graph/badge.svg
|
|
268
|
+
[🏀coveralls]: https://coveralls.io/github/structuredmerge/structuredmerge-ruby?branch=main
|
|
269
|
+
[🏀coveralls-img]: https://coveralls.io/repos/github/structuredmerge/structuredmerge-ruby/badge.svg?branch=main
|
|
270
|
+
[🚎2-cov-wf]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/coverage.yml
|
|
271
|
+
[🚎2-cov-wfi]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/coverage.yml/badge.svg
|
|
227
272
|
[🚎11-c-wf]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml
|
|
228
273
|
[🚎11-c-wfi]: https://github.com/structuredmerge/structuredmerge-ruby/actions/workflows/current.yml/badge.svg
|
|
229
274
|
[💎ruby-c-i]: https://img.shields.io/badge/Ruby-current-CC342D?style=for-the-badge&logo=ruby&logoColor=green
|
|
@@ -235,11 +280,12 @@ the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.
|
|
|
235
280
|
[🤝cb-pulls]: https://codeberg.org/structuredmerge/structuredmerge-ruby/pulls
|
|
236
281
|
[🤝cb-donate]: https://donate.codeberg.org/
|
|
237
282
|
[🤝contributing]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CONTRIBUTING.md
|
|
283
|
+
[🏀codecov-g]: https://codecov.io/gh/structuredmerge/structuredmerge-ruby/graph/badge.svg
|
|
238
284
|
[🖐contrib-rocks]: https://contrib.rocks
|
|
239
285
|
[🖐contributors]: https://github.com/structuredmerge/structuredmerge-ruby/graphs/contributors
|
|
240
286
|
[🖐contributors-img]: https://contrib.rocks/image?repo=structuredmerge/structuredmerge-ruby
|
|
241
287
|
[🪇conduct]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CODE_OF_CONDUCT.md
|
|
242
|
-
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-
|
|
288
|
+
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-3.0-259D6C.svg
|
|
243
289
|
[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
244
290
|
[📌semver]: https://semver.org/spec/v2.0.0.html
|
|
245
291
|
[📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
|
|
@@ -251,7 +297,7 @@ the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.
|
|
|
251
297
|
[📌gitmoji]: https://gitmoji.dev
|
|
252
298
|
[📌gitmoji-img]: https://img.shields.io/badge/gitmoji_commits-%20%F0%9F%98%9C%20%F0%9F%98%8D-34495e.svg?style=flat-square
|
|
253
299
|
[🧮kloc]: https://www.youtube.com/watch?v=dQw4w9WgXcQ
|
|
254
|
-
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.
|
|
300
|
+
[🧮kloc-img]: https://img.shields.io/badge/KLOC-0.585-FFDD67.svg?style=for-the-badge&logo=YouTube&logoColor=blue
|
|
255
301
|
[🔐security]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/SECURITY.md
|
|
256
302
|
[🔐security-img]: https://img.shields.io/badge/security-policy-259D6C.svg?style=flat
|
|
257
303
|
[📄copyright-notice-explainer]: https://opensource.stackexchange.com/questions/5778/why-do-licenses-such-as-the-mit-license-specify-a-single-year
|
|
@@ -260,6 +306,7 @@ the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.
|
|
|
260
306
|
[📄license-img]: https://img.shields.io/badge/License-MIT-259D6C.svg
|
|
261
307
|
[📄license-compat]: https://www.apache.org/legal/resolved.html#category-a
|
|
262
308
|
[📄license-compat-img]: https://img.shields.io/badge/Apache_Compatible:_Category_A-%E2%9C%93-259D6C.svg?style=flat&logo=Apache
|
|
309
|
+
|
|
263
310
|
[📄ilo-declaration]: https://www.ilo.org/declaration/lang--en/index.htm
|
|
264
311
|
[📄ilo-declaration-img]: https://img.shields.io/badge/ILO_Fundamental_Principles-✓-259D6C.svg?style=flat
|
|
265
312
|
[🚎yard-current]: http://rubydoc.info/gems/html-merge
|
|
@@ -271,3 +318,5 @@ the [MIT](https://github.com/structuredmerge/structuredmerge-ruby/blob/main/MIT.
|
|
|
271
318
|
[💎appraisal2]: https://github.com/appraisal-rb/appraisal2
|
|
272
319
|
[💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
|
|
273
320
|
[💎d-in-dvcs]: https://railsbling.com/posts/dvcs/put_the_d_in_dvcs/
|
|
321
|
+
|
|
322
|
+
[kettle-readme-backers]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/bin/kettle-readme-backers
|
|
@@ -13,7 +13,7 @@ module Html
|
|
|
13
13
|
unless result.fetch(:ok)
|
|
14
14
|
raise Ast::Crispr::Error.new(
|
|
15
15
|
"Unable to parse HTML for CRISPR",
|
|
16
|
-
details: {
|
|
16
|
+
details: {source_label: document.source_label, diagnostics: result.fetch(:diagnostics)}
|
|
17
17
|
)
|
|
18
18
|
end
|
|
19
19
|
|
|
@@ -23,7 +23,7 @@ module Html
|
|
|
23
23
|
def structural_owners(document, owner_scope: :html_element)
|
|
24
24
|
unless owner_scope.to_sym == :html_element
|
|
25
25
|
raise Ast::Crispr::Error.new("Unsupported HTML CRISPR owner scope",
|
|
26
|
-
|
|
26
|
+
details: {owner_scope: owner_scope})
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
root = Html::Merge.html_root_node(document.content)
|
|
@@ -46,7 +46,7 @@ module Html
|
|
|
46
46
|
def comment_regions_for(_document, _owner, region: :leading, owner_scope: :html_element)
|
|
47
47
|
raise Ast::Crispr::Error.new(
|
|
48
48
|
"HTML CRISPR comment regions are not implemented",
|
|
49
|
-
details: {
|
|
49
|
+
details: {region: region, owner_scope: owner_scope}
|
|
50
50
|
)
|
|
51
51
|
end
|
|
52
52
|
|
|
@@ -58,7 +58,7 @@ module Html
|
|
|
58
58
|
Ast::Crispr::StructureProfile.new(
|
|
59
59
|
owner_scope: owner_scope,
|
|
60
60
|
owner_selector: :html_element,
|
|
61
|
-
metadata: {
|
|
61
|
+
metadata: {source: :html_merge}
|
|
62
62
|
)
|
|
63
63
|
end
|
|
64
64
|
end
|
|
@@ -11,7 +11,7 @@ module Html
|
|
|
11
11
|
@backend = BACKEND_REFERENCE.id.to_sym
|
|
12
12
|
@errors = []
|
|
13
13
|
parse!
|
|
14
|
-
rescue
|
|
14
|
+
rescue => e
|
|
15
15
|
@root_node = nil
|
|
16
16
|
@wrappers = [].freeze
|
|
17
17
|
@document_semantics = nil
|
|
@@ -50,8 +50,8 @@ module Html
|
|
|
50
50
|
|
|
51
51
|
def duplicate_issues(duplicates)
|
|
52
52
|
duplicates.keys.map do |id|
|
|
53
|
-
{
|
|
54
|
-
|
|
53
|
+
{category: :ambiguous_owner, identity: [:id, id],
|
|
54
|
+
message: "duplicate explicit HTML id #{id.inspect}"}.freeze
|
|
55
55
|
end.freeze
|
|
56
56
|
end
|
|
57
57
|
|
data/lib/html/merge/provider.rb
CHANGED
|
@@ -14,7 +14,7 @@ module Html
|
|
|
14
14
|
DEFAULT_PROFILE = :source_preserving
|
|
15
15
|
VOID_ELEMENTS = %w[area base br col embed hr img input link meta param source track wbr].freeze
|
|
16
16
|
Owner = Data.define(:id, :signature, :fingerprint, :start_byte, :end_byte, :node_start, :node_end,
|
|
17
|
-
|
|
17
|
+
:parent_key, :role, :source_text)
|
|
18
18
|
Document = Data.define(:source, :analysis, :owners, :by_id, :unmanaged_fingerprint, :parents)
|
|
19
19
|
ExactDocument = Data.define(:source, :analysis, :issues, :role)
|
|
20
20
|
Decision = Data.define(:changes, :conflicts, :choices)
|
|
@@ -47,7 +47,7 @@ module Html
|
|
|
47
47
|
owners: document.owners.map { |owner| owner_description(owner) }
|
|
48
48
|
},
|
|
49
49
|
diagnostics: nonblocking_issues(document.analysis, :source),
|
|
50
|
-
verification: {
|
|
50
|
+
verification: {source_parsed: true, ast_attributes_verified: true}
|
|
51
51
|
)
|
|
52
52
|
end
|
|
53
53
|
|
|
@@ -62,9 +62,9 @@ module Html
|
|
|
62
62
|
result(
|
|
63
63
|
:diff2,
|
|
64
64
|
request,
|
|
65
|
-
diff: {
|
|
65
|
+
diff: {changes: changes},
|
|
66
66
|
changes: changes,
|
|
67
|
-
verification: {
|
|
67
|
+
verification: {before_parsed: true, after_parsed: true, ast_attributes_verified: true}
|
|
68
68
|
)
|
|
69
69
|
end
|
|
70
70
|
|
|
@@ -104,7 +104,7 @@ module Html
|
|
|
104
104
|
end
|
|
105
105
|
|
|
106
106
|
def parse_document(operation, request, role)
|
|
107
|
-
key = role == :source ? :source : :"#{role}_source"
|
|
107
|
+
key = (role == :source) ? :source : :"#{role}_source"
|
|
108
108
|
parsed = parse_source(request.fetch(key), role)
|
|
109
109
|
return parse_failure(operation, request, role, parsed) if provider_failure?(parsed)
|
|
110
110
|
|
|
@@ -113,11 +113,11 @@ module Html
|
|
|
113
113
|
|
|
114
114
|
def parse_source(source, role)
|
|
115
115
|
analysis = FileAnalysis.new(source)
|
|
116
|
-
return {
|
|
117
|
-
return {
|
|
116
|
+
return {parse_error: analysis.errors.map(&:to_s).join("; "), source_role: role} unless analysis.valid?
|
|
117
|
+
return {ambiguous_owner: analysis.issues.first, source_role: role} unless analysis.issues.empty?
|
|
118
118
|
|
|
119
119
|
owners = analysis.wrappers.map do |wrapper|
|
|
120
|
-
return {
|
|
120
|
+
return {unsafe_range: wrapper.tag_name, source_role: role} unless safe_wrapper?(wrapper, source)
|
|
121
121
|
|
|
122
122
|
start_byte, end_byte = expanded_range(source, wrapper.start_byte, wrapper.end_byte)
|
|
123
123
|
signature = owner_signature(wrapper)
|
|
@@ -135,8 +135,8 @@ module Html
|
|
|
135
135
|
)
|
|
136
136
|
end
|
|
137
137
|
duplicate = owners.group_by(&:id).find { |_id, matches| matches.length > 1 }
|
|
138
|
-
return {
|
|
139
|
-
return {
|
|
138
|
+
return {ambiguous_owner: duplicate.first, source_role: role} if duplicate
|
|
139
|
+
return {unsafe_range: :overlapping_owners, source_role: role} unless non_overlapping?(owners)
|
|
140
140
|
|
|
141
141
|
Document.new(
|
|
142
142
|
source: source,
|
|
@@ -146,17 +146,17 @@ module Html
|
|
|
146
146
|
unmanaged_fingerprint: unmanaged_fingerprint(source, owners),
|
|
147
147
|
parents: parent_anchors(analysis, source).freeze
|
|
148
148
|
)
|
|
149
|
-
rescue
|
|
150
|
-
{
|
|
149
|
+
rescue => e
|
|
150
|
+
{parse_error: e.message, source_role: role}
|
|
151
151
|
end
|
|
152
152
|
|
|
153
153
|
def parse_exact_source(source, role)
|
|
154
154
|
analysis = FileAnalysis.new(source)
|
|
155
|
-
return {
|
|
155
|
+
return {parse_error: analysis.errors.map(&:to_s).join("; "), source_role: role} unless analysis.valid?
|
|
156
156
|
|
|
157
157
|
ExactDocument.new(source: source, analysis: analysis, issues: analysis.issues, role: role)
|
|
158
|
-
rescue
|
|
159
|
-
{
|
|
158
|
+
rescue => e
|
|
159
|
+
{parse_error: e.message, source_role: role}
|
|
160
160
|
end
|
|
161
161
|
|
|
162
162
|
def owner_signature(wrapper)
|
|
@@ -182,17 +182,18 @@ module Html
|
|
|
182
182
|
end
|
|
183
183
|
|
|
184
184
|
def expanded_range(source, start_byte, end_byte)
|
|
185
|
-
|
|
185
|
+
bytes = source.b
|
|
186
|
+
line_start = bytes.rindex("\n", [start_byte - 1, 0].max)
|
|
186
187
|
line_start = line_start ? line_start + 1 : 0
|
|
187
|
-
if end_byte.positive? &&
|
|
188
|
-
|
|
188
|
+
if end_byte.positive? && bytes.getbyte(end_byte - 1) == 10 &&
|
|
189
|
+
whitespace?(bytes.byteslice(line_start...start_byte).to_s)
|
|
189
190
|
return [line_start, end_byte]
|
|
190
191
|
end
|
|
191
192
|
|
|
192
|
-
line_end =
|
|
193
|
-
if whitespace?(
|
|
194
|
-
|
|
195
|
-
[line_start, line_end ? line_end + 1 :
|
|
193
|
+
line_end = bytes.index("\n", end_byte)
|
|
194
|
+
if whitespace?(bytes.byteslice(line_start...start_byte).to_s) &&
|
|
195
|
+
whitespace?(bytes.byteslice(end_byte...(line_end || bytes.bytesize)).to_s)
|
|
196
|
+
[line_start, line_end ? line_end + 1 : bytes.bytesize]
|
|
196
197
|
else
|
|
197
198
|
[start_byte, end_byte]
|
|
198
199
|
end
|
|
@@ -207,9 +208,9 @@ module Html
|
|
|
207
208
|
end
|
|
208
209
|
|
|
209
210
|
def unmanaged_fingerprint(source, owners)
|
|
210
|
-
output = source.
|
|
211
|
+
output = source.b
|
|
211
212
|
owners.reverse_each { |owner| output[owner.start_byte...owner.end_byte] = "" }
|
|
212
|
-
fingerprint(output)
|
|
213
|
+
fingerprint(output.force_encoding(source.encoding))
|
|
213
214
|
end
|
|
214
215
|
|
|
215
216
|
def parent_key(wrapper)
|
|
@@ -225,14 +226,14 @@ module Html
|
|
|
225
226
|
end
|
|
226
227
|
|
|
227
228
|
def parent_anchors(analysis, source)
|
|
228
|
-
anchors = {
|
|
229
|
+
anchors = {[:document] => source.bytesize}
|
|
229
230
|
walk = lambda do |node|
|
|
230
231
|
wrapper = NodeWrapper.new(node, source: source)
|
|
231
232
|
if wrapper.element?
|
|
232
233
|
id = wrapper.explicit_id
|
|
233
234
|
anchors[[:id, id]] = insertion_anchor(node) if id.is_a?(String) && !id.empty?
|
|
234
235
|
anchors[[:boundary, wrapper.tag_name]] = insertion_anchor(node) if %w[html head
|
|
235
|
-
|
|
236
|
+
body].include?(wrapper.tag_name)
|
|
236
237
|
end
|
|
237
238
|
node.children.each { |child| walk.call(child) }
|
|
238
239
|
end
|
|
@@ -272,10 +273,10 @@ module Html
|
|
|
272
273
|
|
|
273
274
|
def change_side(owner)
|
|
274
275
|
if owner
|
|
275
|
-
{
|
|
276
|
-
|
|
276
|
+
{present: true, source_role: owner.role,
|
|
277
|
+
byte_range: [owner.start_byte, owner.end_byte]}
|
|
277
278
|
else
|
|
278
|
-
{
|
|
279
|
+
{present: false}
|
|
279
280
|
end
|
|
280
281
|
end
|
|
281
282
|
|
|
@@ -299,7 +300,7 @@ module Html
|
|
|
299
300
|
theirs_change = side_change_kind(base, theirs)
|
|
300
301
|
next choices[id] = :ours if ours_change == :unchanged && theirs_change == :unchanged
|
|
301
302
|
|
|
302
|
-
change = {
|
|
303
|
+
change = {path: owner_path(base || ours || theirs), ours: ours_change, theirs: theirs_change}.freeze
|
|
303
304
|
changes << change
|
|
304
305
|
choice = owner_choice(base, ours, theirs)
|
|
305
306
|
if choice == :conflict
|
|
@@ -319,8 +320,8 @@ module Html
|
|
|
319
320
|
|
|
320
321
|
change = {
|
|
321
322
|
path: "<unmanaged-source>",
|
|
322
|
-
ours: base == ours ? :unchanged : :edited,
|
|
323
|
-
theirs: base == theirs ? :unchanged : :edited
|
|
323
|
+
ours: (base == ours) ? :unchanged : :edited,
|
|
324
|
+
theirs: (base == theirs) ? :unchanged : :edited
|
|
324
325
|
}.freeze
|
|
325
326
|
changes << change
|
|
326
327
|
conflicts << {
|
|
@@ -352,7 +353,7 @@ module Html
|
|
|
352
353
|
def conflict_for(id, base, ours, theirs, change)
|
|
353
354
|
{
|
|
354
355
|
conflict_id: "html-owner-#{id[0, 16]}",
|
|
355
|
-
category: base && (!ours || !theirs) ? :delete_edit : :edit_edit,
|
|
356
|
+
category: (base && (!ours || !theirs)) ? :delete_edit : :edit_edit,
|
|
356
357
|
path: change.fetch(:path),
|
|
357
358
|
owner_id: id,
|
|
358
359
|
base: owner_state(base),
|
|
@@ -363,7 +364,7 @@ module Html
|
|
|
363
364
|
end
|
|
364
365
|
|
|
365
366
|
def owner_state(owner)
|
|
366
|
-
{
|
|
367
|
+
{present: !owner.nil?, fingerprint: owner&.fingerprint, source_role: owner&.role}
|
|
367
368
|
end
|
|
368
369
|
|
|
369
370
|
def exact_revision_role(request)
|
|
@@ -399,8 +400,8 @@ module Html
|
|
|
399
400
|
def verify_exact(output, expected)
|
|
400
401
|
parsed = parse_exact_source(output, :output)
|
|
401
402
|
if provider_failure?(parsed)
|
|
402
|
-
return {
|
|
403
|
-
|
|
403
|
+
return {output_reparsed: false, byte_exact: output == expected.source,
|
|
404
|
+
semantic_match: false}
|
|
404
405
|
end
|
|
405
406
|
|
|
406
407
|
{
|
|
@@ -416,8 +417,8 @@ module Html
|
|
|
416
417
|
def exact_diagnostics(documents)
|
|
417
418
|
documents.flat_map do |role, document|
|
|
418
419
|
if provider_failure?(document)
|
|
419
|
-
[{
|
|
420
|
-
|
|
420
|
+
[{category: :parse_error, severity: :warning, message: "#{role} parse error", blocking: false,
|
|
421
|
+
source_role: role}]
|
|
421
422
|
else
|
|
422
423
|
nonblocking_issues(document.analysis, role)
|
|
423
424
|
end
|
|
@@ -443,7 +444,7 @@ module Html
|
|
|
443
444
|
verification = verify_composite(output, expected)
|
|
444
445
|
unless verification[:semantic_match]
|
|
445
446
|
return render_failure(request, verification, :exact_html_composite,
|
|
446
|
-
|
|
447
|
+
decision.changes)
|
|
447
448
|
end
|
|
448
449
|
|
|
449
450
|
result(
|
|
@@ -493,11 +494,11 @@ module Html
|
|
|
493
494
|
end
|
|
494
495
|
|
|
495
496
|
def apply_edits(source, edits)
|
|
496
|
-
output = source.
|
|
497
|
+
output = source.b
|
|
497
498
|
edits.sort_by { |edit| [edit.fetch(:start_byte), edit.fetch(:end_byte)] }.reverse_each do |edit|
|
|
498
|
-
output[edit.fetch(:start_byte)...edit.fetch(:end_byte)] = edit.fetch(:content)
|
|
499
|
+
output[edit.fetch(:start_byte)...edit.fetch(:end_byte)] = edit.fetch(:content).b
|
|
499
500
|
end
|
|
500
|
-
output
|
|
501
|
+
output.force_encoding(source.encoding)
|
|
501
502
|
end
|
|
502
503
|
|
|
503
504
|
def expected_owner_states(documents, decision)
|
|
@@ -511,11 +512,11 @@ module Html
|
|
|
511
512
|
def verify_composite(output, expected)
|
|
512
513
|
parsed = parse_source(output, :output)
|
|
513
514
|
if provider_failure?(parsed)
|
|
514
|
-
return {
|
|
515
|
+
return {output_reparsed: false, semantic_match: false, parse_error: failure_detail(parsed)}
|
|
515
516
|
end
|
|
516
517
|
|
|
517
518
|
actual = parsed.owners.map { |owner| [owner.signature, owner.fingerprint] }
|
|
518
|
-
|
|
519
|
+
.sort_by { |value| JSON.generate(Ast::Merge.json_ready(value.first)) }
|
|
519
520
|
{
|
|
520
521
|
output_reparsed: true,
|
|
521
522
|
semantic_match: actual == expected,
|
|
@@ -531,8 +532,8 @@ module Html
|
|
|
531
532
|
return conflict_failure(request, decision, localized, :element_localized_conflict) if localized
|
|
532
533
|
|
|
533
534
|
conflict_failure(request, decision, whole_document_conflict(request), :full_file_conflict,
|
|
534
|
-
|
|
535
|
-
|
|
535
|
+
[{from: :element_localization, to: :full_file_conflict,
|
|
536
|
+
reason: :source_ownership_unproven}])
|
|
536
537
|
end
|
|
537
538
|
|
|
538
539
|
def localized_conflict_output(request, documents, decision)
|
|
@@ -555,7 +556,7 @@ module Html
|
|
|
555
556
|
def conflict_text(request, documents, conflict)
|
|
556
557
|
marker = request.fetch(:conflict_marker_size, 7).to_i
|
|
557
558
|
marker = 7 unless marker.positive?
|
|
558
|
-
labels = {
|
|
559
|
+
labels = {ours: "ours", base: "base", theirs: "theirs"}.merge(request.fetch(:labels, {}))
|
|
559
560
|
sides = %i[ours base theirs].to_h do |role|
|
|
560
561
|
owner = documents.fetch(role).by_id[conflict.fetch(:owner_id)]
|
|
561
562
|
[role, owner&.source_text.to_s]
|
|
@@ -589,8 +590,8 @@ module Html
|
|
|
589
590
|
conflicts: decision.conflicts,
|
|
590
591
|
conflicted_output: output,
|
|
591
592
|
fallbacks: fallbacks,
|
|
592
|
-
render_report: {
|
|
593
|
-
verification: {
|
|
593
|
+
render_report: {strategy: strategy, provenance: :exact_source_bytes},
|
|
594
|
+
verification: {base_participated: true}
|
|
594
595
|
)
|
|
595
596
|
end
|
|
596
597
|
|
|
@@ -613,8 +614,8 @@ module Html
|
|
|
613
614
|
conflicts: [conflict],
|
|
614
615
|
conflicted_output: whole_document_conflict(request),
|
|
615
616
|
source_role: role,
|
|
616
|
-
render_report: {
|
|
617
|
-
verification: {
|
|
617
|
+
render_report: {strategy: :full_file_conflict, provenance: :exact_source_bytes},
|
|
618
|
+
verification: {base_participated: true}
|
|
618
619
|
)
|
|
619
620
|
end
|
|
620
621
|
|
|
@@ -625,11 +626,11 @@ module Html
|
|
|
625
626
|
category: :unsafe_source_range,
|
|
626
627
|
message: "HTML composite insertion has no parser-proven parent closing boundary.",
|
|
627
628
|
changes: decision.changes,
|
|
628
|
-
conflicts: [{
|
|
629
|
+
conflicts: [{conflict_id: "html-parent-#{reason}", category: reason, path: "<document>", owner_id: nil}],
|
|
629
630
|
conflicted_output: whole_document_conflict(request),
|
|
630
|
-
fallbacks: [{
|
|
631
|
-
render_report: {
|
|
632
|
-
verification: {
|
|
631
|
+
fallbacks: [{from: :element_composite, to: :full_file_conflict, reason: reason}],
|
|
632
|
+
render_report: {strategy: :full_file_conflict, provenance: :exact_source_bytes},
|
|
633
|
+
verification: {base_participated: true}
|
|
633
634
|
)
|
|
634
635
|
end
|
|
635
636
|
|
|
@@ -640,7 +641,7 @@ module Html
|
|
|
640
641
|
category: :render_failure,
|
|
641
642
|
message: "HTML output failed native parser and ordered semantic verification.",
|
|
642
643
|
changes: changes,
|
|
643
|
-
render_report: {
|
|
644
|
+
render_report: {strategy: strategy},
|
|
644
645
|
verification: verification.merge(base_participated: true)
|
|
645
646
|
)
|
|
646
647
|
end
|
|
@@ -648,7 +649,7 @@ module Html
|
|
|
648
649
|
def exact_render_report(role, output)
|
|
649
650
|
{
|
|
650
651
|
strategy: :exact_revision,
|
|
651
|
-
provenance: [{
|
|
652
|
+
provenance: [{source_role: role, byte_range: [0, output.bytesize], copied_source: true}],
|
|
652
653
|
synthesized_fragments: []
|
|
653
654
|
}
|
|
654
655
|
end
|
|
@@ -678,10 +679,10 @@ module Html
|
|
|
678
679
|
|
|
679
680
|
def parse_failure(operation, request, role, parsed)
|
|
680
681
|
category = if parsed[:parse_error]
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
682
|
+
:parse_error
|
|
683
|
+
else
|
|
684
|
+
parsed[:ambiguous_owner] ? :ambiguous_owner : :unsafe_source_range
|
|
685
|
+
end
|
|
685
686
|
failure(
|
|
686
687
|
operation,
|
|
687
688
|
request,
|
|
@@ -719,7 +720,7 @@ module Html
|
|
|
719
720
|
end
|
|
720
721
|
|
|
721
722
|
def failure(operation, request, category:, message:, changes: [], conflicts: [], fallbacks: [],
|
|
722
|
-
|
|
723
|
+
render_report: {}, verification: {}, **payload)
|
|
723
724
|
Ast::Merge::ProviderResult.build(
|
|
724
725
|
operation: operation,
|
|
725
726
|
success: false,
|
|
@@ -728,7 +729,7 @@ module Html
|
|
|
728
729
|
changes: changes,
|
|
729
730
|
conflicts: conflicts,
|
|
730
731
|
fallbacks: fallbacks,
|
|
731
|
-
diagnostics: [{
|
|
732
|
+
diagnostics: [{category: category, severity: :error, message: message, blocking: true}],
|
|
732
733
|
render_report: render_report,
|
|
733
734
|
verification: verification
|
|
734
735
|
),
|
|
@@ -746,7 +747,7 @@ module Html
|
|
|
746
747
|
package: "html-merge",
|
|
747
748
|
package_version: Html::Merge::Version::VERSION
|
|
748
749
|
},
|
|
749
|
-
profile: {
|
|
750
|
+
profile: {profile_id: request[:profile_id] || DEFAULT_PROFILE}
|
|
750
751
|
}.merge(fields)
|
|
751
752
|
end
|
|
752
753
|
end
|
data/lib/html/merge/version.rb
CHANGED
|
@@ -5,7 +5,7 @@ module Html
|
|
|
5
5
|
# Version namespace for this gem.
|
|
6
6
|
module Version
|
|
7
7
|
# Current gem version.
|
|
8
|
-
VERSION = "
|
|
8
|
+
VERSION = "8.0.0"
|
|
9
9
|
end
|
|
10
10
|
# Current gem version exposed at the traditional constant location.
|
|
11
11
|
VERSION = Version::VERSION # Traditional Constant Location
|
data/lib/html/merge.rb
CHANGED
|
@@ -92,7 +92,7 @@ module Html
|
|
|
92
92
|
span: html_node_span(node)
|
|
93
93
|
}
|
|
94
94
|
end
|
|
95
|
-
return {
|
|
95
|
+
return {ok: false, diagnostics: diagnostics, policies: []} unless diagnostics.empty?
|
|
96
96
|
|
|
97
97
|
{
|
|
98
98
|
ok: true,
|
|
@@ -167,7 +167,7 @@ module Html
|
|
|
167
167
|
|
|
168
168
|
def html_raw_point(node, boundary)
|
|
169
169
|
raw_node = node.respond_to?(:inner_node) ? node.inner_node : node
|
|
170
|
-
methods = boundary == :start ? %i[start_point start_position] : %i[end_point end_position]
|
|
170
|
+
methods = (boundary == :start) ? %i[start_point start_position] : %i[end_point end_position]
|
|
171
171
|
methods.each do |method_name|
|
|
172
172
|
return raw_node.public_send(method_name) if raw_node.respond_to?(method_name)
|
|
173
173
|
end
|
|
@@ -176,9 +176,9 @@ module Html
|
|
|
176
176
|
end
|
|
177
177
|
|
|
178
178
|
def html_point(point)
|
|
179
|
-
return {
|
|
179
|
+
return {row: point.row, column: point.column} if point.respond_to?(:row) && point.respond_to?(:column)
|
|
180
180
|
|
|
181
|
-
return {
|
|
181
|
+
return {row: point[:row], column: point[:column]} if point.respond_to?(:[])
|
|
182
182
|
|
|
183
183
|
raise Error, "Unsupported TreeHaver point #{point.inspect}"
|
|
184
184
|
end
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: html-merge
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 8.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Peter H. Boling
|
|
@@ -44,7 +44,7 @@ dependencies:
|
|
|
44
44
|
-
|
|
45
45
|
- "="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version:
|
|
47
|
+
version: 8.0.0
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -52,7 +52,7 @@ dependencies:
|
|
|
52
52
|
-
|
|
53
53
|
- "="
|
|
54
54
|
- !ruby/object:Gem::Version
|
|
55
|
-
version:
|
|
55
|
+
version: 8.0.0
|
|
56
56
|
- !ruby/object:Gem::Dependency
|
|
57
57
|
name: ast-merge
|
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -60,7 +60,7 @@ dependencies:
|
|
|
60
60
|
-
|
|
61
61
|
- "="
|
|
62
62
|
- !ruby/object:Gem::Version
|
|
63
|
-
version:
|
|
63
|
+
version: 8.0.0
|
|
64
64
|
type: :runtime
|
|
65
65
|
prerelease: false
|
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -68,7 +68,7 @@ dependencies:
|
|
|
68
68
|
-
|
|
69
69
|
- "="
|
|
70
70
|
- !ruby/object:Gem::Version
|
|
71
|
-
version:
|
|
71
|
+
version: 8.0.0
|
|
72
72
|
- !ruby/object:Gem::Dependency
|
|
73
73
|
name: tree_haver
|
|
74
74
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,7 +76,7 @@ dependencies:
|
|
|
76
76
|
-
|
|
77
77
|
- "="
|
|
78
78
|
- !ruby/object:Gem::Version
|
|
79
|
-
version:
|
|
79
|
+
version: 8.0.0
|
|
80
80
|
type: :runtime
|
|
81
81
|
prerelease: false
|
|
82
82
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -84,7 +84,7 @@ dependencies:
|
|
|
84
84
|
-
|
|
85
85
|
- "="
|
|
86
86
|
- !ruby/object:Gem::Version
|
|
87
|
-
version:
|
|
87
|
+
version: 8.0.0
|
|
88
88
|
- !ruby/object:Gem::Dependency
|
|
89
89
|
name: version_gem
|
|
90
90
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -120,7 +120,7 @@ dependencies:
|
|
|
120
120
|
-
|
|
121
121
|
- ">="
|
|
122
122
|
- !ruby/object:Gem::Version
|
|
123
|
-
version: 3.1.
|
|
123
|
+
version: 3.1.41
|
|
124
124
|
type: :development
|
|
125
125
|
prerelease: false
|
|
126
126
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -132,7 +132,7 @@ dependencies:
|
|
|
132
132
|
-
|
|
133
133
|
- ">="
|
|
134
134
|
- !ruby/object:Gem::Version
|
|
135
|
-
version: 3.1.
|
|
135
|
+
version: 3.1.41
|
|
136
136
|
- !ruby/object:Gem::Dependency
|
|
137
137
|
name: bundler-audit
|
|
138
138
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -248,7 +248,7 @@ dependencies:
|
|
|
248
248
|
-
|
|
249
249
|
- ">="
|
|
250
250
|
- !ruby/object:Gem::Version
|
|
251
|
-
version: 2.0.
|
|
251
|
+
version: 2.0.32
|
|
252
252
|
type: :development
|
|
253
253
|
prerelease: false
|
|
254
254
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -260,7 +260,7 @@ dependencies:
|
|
|
260
260
|
-
|
|
261
261
|
- ">="
|
|
262
262
|
- !ruby/object:Gem::Version
|
|
263
|
-
version: 2.0.
|
|
263
|
+
version: 2.0.32
|
|
264
264
|
- !ruby/object:Gem::Dependency
|
|
265
265
|
name: turbo_tests2
|
|
266
266
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -370,10 +370,10 @@ licenses:
|
|
|
370
370
|
- MIT
|
|
371
371
|
metadata:
|
|
372
372
|
homepage_uri: "https://structuredmerge.org"
|
|
373
|
-
source_code_uri: "https://github.com/structuredmerge/structuredmerge-ruby/tree/
|
|
374
|
-
changelog_uri: "https://github.com/structuredmerge/structuredmerge-ruby/blob/
|
|
373
|
+
source_code_uri: "https://github.com/structuredmerge/structuredmerge-ruby/tree/v8.0.0"
|
|
374
|
+
changelog_uri: "https://github.com/structuredmerge/structuredmerge-ruby/blob/v8.0.0/CHANGELOG.md"
|
|
375
375
|
bug_tracker_uri: "https://github.com/structuredmerge/structuredmerge-ruby/issues"
|
|
376
|
-
documentation_uri: "https://www.rubydoc.info/gems/html-merge/
|
|
376
|
+
documentation_uri: "https://www.rubydoc.info/gems/html-merge/8.0.0"
|
|
377
377
|
funding_uri: "https://github.com/sponsors/pboling"
|
|
378
378
|
wiki_uri: "https://github.com/structuredmerge/structuredmerge-ruby/wiki"
|
|
379
379
|
news_uri: "https://www.railsbling.com/tags/html-merge"
|
metadata.gz.sig
CHANGED
|
Binary file
|