html-merge 7.1.22 → 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 +36 -5
- data/lib/html/merge/crispr_adapter.rb +4 -4
- data/lib/html/merge/file_analysis.rb +3 -3
- data/lib/html/merge/provider.rb +54 -54
- 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
|
@@ -8,9 +8,10 @@
|
|
|
8
8
|
|
|
9
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.
|
|
10
10
|
|
|
11
|
-
[![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]
|
|
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]
|
|
12
12
|
|
|
13
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>
|
|
14
15
|
<!-- kettle-sponsors:shields:end -->
|
|
15
16
|
|
|
16
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>
|
|
@@ -56,6 +57,17 @@ puts result.dig(:analysis, :nodes)
|
|
|
56
57
|
Use `Html::Merge.html_plan_context` to advertise the available backend and
|
|
57
58
|
`Html::Merge.ensure_yard_content_wrapper` when repairing YARD-generated HTML.
|
|
58
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
|
+
|
|
59
71
|
## 💡 Info you can shake a stick at
|
|
60
72
|
|
|
61
73
|
| Tokens to Remember | [![Gem name][⛳️name-img]][⛳️gem-name] [![Gem namespace][⛳️namespace-img]][⛳️gem-namespace] |
|
|
@@ -64,7 +76,7 @@ Use `Html::Merge.html_plan_context` to advertise the available backend and
|
|
|
64
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] |
|
|
65
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] |
|
|
66
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] |
|
|
67
|
-
| 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] |
|
|
68
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] |
|
|
69
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] |
|
|
70
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] |
|
|
@@ -111,6 +123,8 @@ We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you m
|
|
|
111
123
|
|
|
112
124
|
See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
|
|
113
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
|
+
|
|
114
128
|
## 📌 Versioning
|
|
115
129
|
|
|
116
130
|
This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
|
|
@@ -148,13 +162,29 @@ Many parts of this project are actively managed by a [kettle-jem](https://github
|
|
|
148
162
|
|
|
149
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:
|
|
150
164
|
|
|
151
|
-
[![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]
|
|
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
|
|
152
171
|
|
|
153
172
|
Thanks for RTFM. ☺️
|
|
154
173
|
|
|
155
174
|
[⛳liberapay-img]: https://img.shields.io/liberapay/goal/pboling.svg?logo=liberapay&color=a51611&style=flat
|
|
156
175
|
[⛳liberapay-bottom-img]: https://img.shields.io/liberapay/goal/pboling.svg?style=for-the-badge&logo=liberapay&color=a51611
|
|
157
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
|
|
158
188
|
[🖇sponsor-img]: https://img.shields.io/badge/Sponsor_Me!-pboling.svg?style=social&logo=github
|
|
159
189
|
[🖇sponsor-bottom-img]: https://img.shields.io/badge/Sponsor_Me!-pboling-blue?style=for-the-badge&logo=github
|
|
160
190
|
[🖇sponsor]: https://github.com/sponsors/pboling
|
|
@@ -207,7 +237,6 @@ Thanks for RTFM. ☺️
|
|
|
207
237
|
[💖🐙hub]: https://github.org/pboling
|
|
208
238
|
[💖🛖hut]: https://sr.ht/~galtzo/
|
|
209
239
|
[💖🧪lab]: https://gitlab.com/pboling
|
|
210
|
-
[🏙️entsup-tidelift-sonar]: https://blog.tidelift.com/tidelift-joins-sonar
|
|
211
240
|
[👨🏼🏫expsup-upwork]: https://www.upwork.com/freelancers/~014942e9b056abdf86?mp_source=share
|
|
212
241
|
[👨🏼🏫expsup-upwork-img]: https://img.shields.io/badge/UpWork-13544E?style=for-the-badge&logo=Upwork&logoColor=white
|
|
213
242
|
[👨🏼🏫expsup-codementor]: https://www.codementor.io/peterboling?utm_source=github&utm_medium=button&utm_term=peterboling&utm_campaign=github
|
|
@@ -256,7 +285,7 @@ Thanks for RTFM. ☺️
|
|
|
256
285
|
[🖐contributors]: https://github.com/structuredmerge/structuredmerge-ruby/graphs/contributors
|
|
257
286
|
[🖐contributors-img]: https://contrib.rocks/image?repo=structuredmerge/structuredmerge-ruby
|
|
258
287
|
[🪇conduct]: https://github.com/structuredmerge/structuredmerge-ruby/blob/main/CODE_OF_CONDUCT.md
|
|
259
|
-
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-
|
|
288
|
+
[🪇conduct-img]: https://img.shields.io/badge/Contributor_Covenant-3.0-259D6C.svg
|
|
260
289
|
[📌pvc]: http://guides.rubygems.org/patterns/#pessimistic-version-constraint
|
|
261
290
|
[📌semver]: https://semver.org/spec/v2.0.0.html
|
|
262
291
|
[📌semver-img]: https://img.shields.io/badge/semver-2.0.0-259D6C.svg?style=flat
|
|
@@ -289,3 +318,5 @@ Thanks for RTFM. ☺️
|
|
|
289
318
|
[💎appraisal2]: https://github.com/appraisal-rb/appraisal2
|
|
290
319
|
[💎appraisal2-img]: https://img.shields.io/badge/appraised_by-appraisal2-34495e.svg?plastic&logo=ruby&logoColor=white
|
|
291
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)
|
|
@@ -186,13 +186,13 @@ module Html
|
|
|
186
186
|
line_start = bytes.rindex("\n", [start_byte - 1, 0].max)
|
|
187
187
|
line_start = line_start ? line_start + 1 : 0
|
|
188
188
|
if end_byte.positive? && bytes.getbyte(end_byte - 1) == 10 &&
|
|
189
|
-
|
|
189
|
+
whitespace?(bytes.byteslice(line_start...start_byte).to_s)
|
|
190
190
|
return [line_start, end_byte]
|
|
191
191
|
end
|
|
192
192
|
|
|
193
193
|
line_end = bytes.index("\n", end_byte)
|
|
194
194
|
if whitespace?(bytes.byteslice(line_start...start_byte).to_s) &&
|
|
195
|
-
|
|
195
|
+
whitespace?(bytes.byteslice(end_byte...(line_end || bytes.bytesize)).to_s)
|
|
196
196
|
[line_start, line_end ? line_end + 1 : bytes.bytesize]
|
|
197
197
|
else
|
|
198
198
|
[start_byte, end_byte]
|
|
@@ -226,14 +226,14 @@ module Html
|
|
|
226
226
|
end
|
|
227
227
|
|
|
228
228
|
def parent_anchors(analysis, source)
|
|
229
|
-
anchors = {
|
|
229
|
+
anchors = {[:document] => source.bytesize}
|
|
230
230
|
walk = lambda do |node|
|
|
231
231
|
wrapper = NodeWrapper.new(node, source: source)
|
|
232
232
|
if wrapper.element?
|
|
233
233
|
id = wrapper.explicit_id
|
|
234
234
|
anchors[[:id, id]] = insertion_anchor(node) if id.is_a?(String) && !id.empty?
|
|
235
235
|
anchors[[:boundary, wrapper.tag_name]] = insertion_anchor(node) if %w[html head
|
|
236
|
-
|
|
236
|
+
body].include?(wrapper.tag_name)
|
|
237
237
|
end
|
|
238
238
|
node.children.each { |child| walk.call(child) }
|
|
239
239
|
end
|
|
@@ -273,10 +273,10 @@ module Html
|
|
|
273
273
|
|
|
274
274
|
def change_side(owner)
|
|
275
275
|
if owner
|
|
276
|
-
{
|
|
277
|
-
|
|
276
|
+
{present: true, source_role: owner.role,
|
|
277
|
+
byte_range: [owner.start_byte, owner.end_byte]}
|
|
278
278
|
else
|
|
279
|
-
{
|
|
279
|
+
{present: false}
|
|
280
280
|
end
|
|
281
281
|
end
|
|
282
282
|
|
|
@@ -300,7 +300,7 @@ module Html
|
|
|
300
300
|
theirs_change = side_change_kind(base, theirs)
|
|
301
301
|
next choices[id] = :ours if ours_change == :unchanged && theirs_change == :unchanged
|
|
302
302
|
|
|
303
|
-
change = {
|
|
303
|
+
change = {path: owner_path(base || ours || theirs), ours: ours_change, theirs: theirs_change}.freeze
|
|
304
304
|
changes << change
|
|
305
305
|
choice = owner_choice(base, ours, theirs)
|
|
306
306
|
if choice == :conflict
|
|
@@ -320,8 +320,8 @@ module Html
|
|
|
320
320
|
|
|
321
321
|
change = {
|
|
322
322
|
path: "<unmanaged-source>",
|
|
323
|
-
ours: base == ours ? :unchanged : :edited,
|
|
324
|
-
theirs: base == theirs ? :unchanged : :edited
|
|
323
|
+
ours: (base == ours) ? :unchanged : :edited,
|
|
324
|
+
theirs: (base == theirs) ? :unchanged : :edited
|
|
325
325
|
}.freeze
|
|
326
326
|
changes << change
|
|
327
327
|
conflicts << {
|
|
@@ -353,7 +353,7 @@ module Html
|
|
|
353
353
|
def conflict_for(id, base, ours, theirs, change)
|
|
354
354
|
{
|
|
355
355
|
conflict_id: "html-owner-#{id[0, 16]}",
|
|
356
|
-
category: base && (!ours || !theirs) ? :delete_edit : :edit_edit,
|
|
356
|
+
category: (base && (!ours || !theirs)) ? :delete_edit : :edit_edit,
|
|
357
357
|
path: change.fetch(:path),
|
|
358
358
|
owner_id: id,
|
|
359
359
|
base: owner_state(base),
|
|
@@ -364,7 +364,7 @@ module Html
|
|
|
364
364
|
end
|
|
365
365
|
|
|
366
366
|
def owner_state(owner)
|
|
367
|
-
{
|
|
367
|
+
{present: !owner.nil?, fingerprint: owner&.fingerprint, source_role: owner&.role}
|
|
368
368
|
end
|
|
369
369
|
|
|
370
370
|
def exact_revision_role(request)
|
|
@@ -400,8 +400,8 @@ module Html
|
|
|
400
400
|
def verify_exact(output, expected)
|
|
401
401
|
parsed = parse_exact_source(output, :output)
|
|
402
402
|
if provider_failure?(parsed)
|
|
403
|
-
return {
|
|
404
|
-
|
|
403
|
+
return {output_reparsed: false, byte_exact: output == expected.source,
|
|
404
|
+
semantic_match: false}
|
|
405
405
|
end
|
|
406
406
|
|
|
407
407
|
{
|
|
@@ -417,8 +417,8 @@ module Html
|
|
|
417
417
|
def exact_diagnostics(documents)
|
|
418
418
|
documents.flat_map do |role, document|
|
|
419
419
|
if provider_failure?(document)
|
|
420
|
-
[{
|
|
421
|
-
|
|
420
|
+
[{category: :parse_error, severity: :warning, message: "#{role} parse error", blocking: false,
|
|
421
|
+
source_role: role}]
|
|
422
422
|
else
|
|
423
423
|
nonblocking_issues(document.analysis, role)
|
|
424
424
|
end
|
|
@@ -444,7 +444,7 @@ module Html
|
|
|
444
444
|
verification = verify_composite(output, expected)
|
|
445
445
|
unless verification[:semantic_match]
|
|
446
446
|
return render_failure(request, verification, :exact_html_composite,
|
|
447
|
-
|
|
447
|
+
decision.changes)
|
|
448
448
|
end
|
|
449
449
|
|
|
450
450
|
result(
|
|
@@ -512,11 +512,11 @@ module Html
|
|
|
512
512
|
def verify_composite(output, expected)
|
|
513
513
|
parsed = parse_source(output, :output)
|
|
514
514
|
if provider_failure?(parsed)
|
|
515
|
-
return {
|
|
515
|
+
return {output_reparsed: false, semantic_match: false, parse_error: failure_detail(parsed)}
|
|
516
516
|
end
|
|
517
517
|
|
|
518
518
|
actual = parsed.owners.map { |owner| [owner.signature, owner.fingerprint] }
|
|
519
|
-
|
|
519
|
+
.sort_by { |value| JSON.generate(Ast::Merge.json_ready(value.first)) }
|
|
520
520
|
{
|
|
521
521
|
output_reparsed: true,
|
|
522
522
|
semantic_match: actual == expected,
|
|
@@ -532,8 +532,8 @@ module Html
|
|
|
532
532
|
return conflict_failure(request, decision, localized, :element_localized_conflict) if localized
|
|
533
533
|
|
|
534
534
|
conflict_failure(request, decision, whole_document_conflict(request), :full_file_conflict,
|
|
535
|
-
|
|
536
|
-
|
|
535
|
+
[{from: :element_localization, to: :full_file_conflict,
|
|
536
|
+
reason: :source_ownership_unproven}])
|
|
537
537
|
end
|
|
538
538
|
|
|
539
539
|
def localized_conflict_output(request, documents, decision)
|
|
@@ -556,7 +556,7 @@ module Html
|
|
|
556
556
|
def conflict_text(request, documents, conflict)
|
|
557
557
|
marker = request.fetch(:conflict_marker_size, 7).to_i
|
|
558
558
|
marker = 7 unless marker.positive?
|
|
559
|
-
labels = {
|
|
559
|
+
labels = {ours: "ours", base: "base", theirs: "theirs"}.merge(request.fetch(:labels, {}))
|
|
560
560
|
sides = %i[ours base theirs].to_h do |role|
|
|
561
561
|
owner = documents.fetch(role).by_id[conflict.fetch(:owner_id)]
|
|
562
562
|
[role, owner&.source_text.to_s]
|
|
@@ -590,8 +590,8 @@ module Html
|
|
|
590
590
|
conflicts: decision.conflicts,
|
|
591
591
|
conflicted_output: output,
|
|
592
592
|
fallbacks: fallbacks,
|
|
593
|
-
render_report: {
|
|
594
|
-
verification: {
|
|
593
|
+
render_report: {strategy: strategy, provenance: :exact_source_bytes},
|
|
594
|
+
verification: {base_participated: true}
|
|
595
595
|
)
|
|
596
596
|
end
|
|
597
597
|
|
|
@@ -614,8 +614,8 @@ module Html
|
|
|
614
614
|
conflicts: [conflict],
|
|
615
615
|
conflicted_output: whole_document_conflict(request),
|
|
616
616
|
source_role: role,
|
|
617
|
-
render_report: {
|
|
618
|
-
verification: {
|
|
617
|
+
render_report: {strategy: :full_file_conflict, provenance: :exact_source_bytes},
|
|
618
|
+
verification: {base_participated: true}
|
|
619
619
|
)
|
|
620
620
|
end
|
|
621
621
|
|
|
@@ -626,11 +626,11 @@ module Html
|
|
|
626
626
|
category: :unsafe_source_range,
|
|
627
627
|
message: "HTML composite insertion has no parser-proven parent closing boundary.",
|
|
628
628
|
changes: decision.changes,
|
|
629
|
-
conflicts: [{
|
|
629
|
+
conflicts: [{conflict_id: "html-parent-#{reason}", category: reason, path: "<document>", owner_id: nil}],
|
|
630
630
|
conflicted_output: whole_document_conflict(request),
|
|
631
|
-
fallbacks: [{
|
|
632
|
-
render_report: {
|
|
633
|
-
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}
|
|
634
634
|
)
|
|
635
635
|
end
|
|
636
636
|
|
|
@@ -641,7 +641,7 @@ module Html
|
|
|
641
641
|
category: :render_failure,
|
|
642
642
|
message: "HTML output failed native parser and ordered semantic verification.",
|
|
643
643
|
changes: changes,
|
|
644
|
-
render_report: {
|
|
644
|
+
render_report: {strategy: strategy},
|
|
645
645
|
verification: verification.merge(base_participated: true)
|
|
646
646
|
)
|
|
647
647
|
end
|
|
@@ -649,7 +649,7 @@ module Html
|
|
|
649
649
|
def exact_render_report(role, output)
|
|
650
650
|
{
|
|
651
651
|
strategy: :exact_revision,
|
|
652
|
-
provenance: [{
|
|
652
|
+
provenance: [{source_role: role, byte_range: [0, output.bytesize], copied_source: true}],
|
|
653
653
|
synthesized_fragments: []
|
|
654
654
|
}
|
|
655
655
|
end
|
|
@@ -679,10 +679,10 @@ module Html
|
|
|
679
679
|
|
|
680
680
|
def parse_failure(operation, request, role, parsed)
|
|
681
681
|
category = if parsed[:parse_error]
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
682
|
+
:parse_error
|
|
683
|
+
else
|
|
684
|
+
parsed[:ambiguous_owner] ? :ambiguous_owner : :unsafe_source_range
|
|
685
|
+
end
|
|
686
686
|
failure(
|
|
687
687
|
operation,
|
|
688
688
|
request,
|
|
@@ -720,7 +720,7 @@ module Html
|
|
|
720
720
|
end
|
|
721
721
|
|
|
722
722
|
def failure(operation, request, category:, message:, changes: [], conflicts: [], fallbacks: [],
|
|
723
|
-
|
|
723
|
+
render_report: {}, verification: {}, **payload)
|
|
724
724
|
Ast::Merge::ProviderResult.build(
|
|
725
725
|
operation: operation,
|
|
726
726
|
success: false,
|
|
@@ -729,7 +729,7 @@ module Html
|
|
|
729
729
|
changes: changes,
|
|
730
730
|
conflicts: conflicts,
|
|
731
731
|
fallbacks: fallbacks,
|
|
732
|
-
diagnostics: [{
|
|
732
|
+
diagnostics: [{category: category, severity: :error, message: message, blocking: true}],
|
|
733
733
|
render_report: render_report,
|
|
734
734
|
verification: verification
|
|
735
735
|
),
|
|
@@ -747,7 +747,7 @@ module Html
|
|
|
747
747
|
package: "html-merge",
|
|
748
748
|
package_version: Html::Merge::Version::VERSION
|
|
749
749
|
},
|
|
750
|
-
profile: {
|
|
750
|
+
profile: {profile_id: request[:profile_id] || DEFAULT_PROFILE}
|
|
751
751
|
}.merge(fields)
|
|
752
752
|
end
|
|
753
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
|