ast-crispr-markdown-markly 7.1.1 → 7.1.3

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: 92d7122e6e9bc649ac5bedf7f8affdd9fc2d6dd5c6f06eb0dd9852eea3f2250c
4
- data.tar.gz: 3751a3eff28dd9a6d22980e580096d32951abe550af1d5fb8ee65d3f454a6e86
3
+ metadata.gz: 29f03a7383c15c86831c377bac56b9664cd302625ee50560ac62d0c62ea71995
4
+ data.tar.gz: 2edc92451689944ec5459b61e51f66cedb62ecebe8d22a68f35b6a85e081e25e
5
5
  SHA512:
6
- metadata.gz: 957009eb5983e817532a7538e3096e41278806e94f2cdbc9532a0844adfae320d75c7c6d9f01e960d9e9f988afb3613b33f0455ee73483cea81b54c4c0ae2590
7
- data.tar.gz: 07d446a671275ba57ed09b90676c9b3ca730fe7cfa7021e7e4524201a1a560319c5e889b8c38efc0fc1c8ffa2c99533839f00a134baee3b841c8aab11f20e880
6
+ metadata.gz: f12e3956e6d5cf340b1263e0b044c0bc9250d041c625dad0a010fc23dc69fe58a904270de7b9a54c5272748a7ad61a3289bf89cf6b536ecdb7aca59c3d06311c
7
+ data.tar.gz: 6edb4631306e0dffda5605205c90e62ece186609067bd882db203c8e07d668b2b70cdd02dddd71b627b45e7d741873fdb13d04a2ccdf7ebc8c6e603c7740cce6
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -46,7 +46,7 @@ I've summarized my thoughts in [this blog post](https://dev.to/galtzo/hostile-ta
46
46
 
47
47
  ### Compatibility
48
48
 
49
- Compatible with MRI Ruby 4.0.0+, and concordant releases of JRuby, and TruffleRuby.
49
+ Compatible with MRI Ruby 4.0.0+, JRuby, and TruffleRuby.
50
50
  CI workflows and Appraisals are generated for MRI Ruby 4.0.0+.
51
51
  This test floor is configured by `ruby.test_minimum` in `.kettle-jem.yml` and
52
52
  may be higher than the gem's runtime compatibility floor when legacy Rubies are
@@ -141,20 +141,12 @@ See [SECURITY.md][🔐security].
141
141
  ## 🤝 Contributing
142
142
 
143
143
  If you need some ideas of where to help, you could work on adding more code coverage,
144
- or if it is already 💯 (see [below](#code-coverage)) check [issues][🤝gh-issues] or [PRs][🤝gh-pulls],
145
- or use the gem and think about how it could be better.
144
+ check [issues][🤝gh-issues] or [PRs][🤝gh-pulls], or use the gem and think about how it could be better.
146
145
 
147
146
  We [![Keep A Changelog][📗keep-changelog-img]][📗keep-changelog] so if you make changes, remember to update it.
148
147
 
149
148
  See [CONTRIBUTING.md][🤝contributing] for more detailed instructions.
150
149
 
151
- ### Code Coverage
152
-
153
- <details markdown="1">
154
- <summary>Coverage service badges</summary>
155
-
156
- </details>
157
-
158
150
  ## 📌 Versioning
159
151
 
160
152
  This library follows [![Semantic Versioning 2.0.0][📌semver-img]][📌semver] for its public API where practical.
@@ -7,7 +7,7 @@ module Ast
7
7
  # Version namespace for this gem.
8
8
  module Version
9
9
  # Current gem version.
10
- VERSION = '7.1.1'
10
+ VERSION = '7.1.3'
11
11
  end
12
12
  # Current gem version exposed at the traditional constant location.
13
13
  VERSION = Version::VERSION # Traditional Constant Location
@@ -28,6 +28,8 @@ module Ast
28
28
  analysis.link_definition_owners
29
29
  when :html_comments
30
30
  analysis.html_comment_owners
31
+ when :html_details
32
+ Ast::Crispr::Markdown::Markly.html_details_owners(analysis)
31
33
  when :list_items
32
34
  analysis.list_item_owners
33
35
  when :inline_references
@@ -73,6 +75,13 @@ module Ast
73
75
  supported_comment_regions: [],
74
76
  metadata: { adapter: :markly, markdown_owner: :html_comment }
75
77
  )
78
+ when :html_details
79
+ Ast::Crispr::StructureProfile.new(
80
+ owner_scope: owner_scope,
81
+ owner_selector: :html_details,
82
+ supported_comment_regions: [],
83
+ metadata: { adapter: :markly, markdown_owner: :html_details }
84
+ )
76
85
  when :list_items
77
86
  Ast::Crispr::StructureProfile.new(
78
87
  owner_scope: owner_scope,
@@ -201,6 +210,37 @@ module Ast
201
210
  )
202
211
  end
203
212
 
213
+ def html_details(summary_text: nil, id: nil, limit: nil, metadata: {}, **options)
214
+ Ast::Crispr::OwnerSelector.new(
215
+ id: id || ['html_details', summary_text].compact.join(':'),
216
+ limit: limit,
217
+ metadata: metadata.merge(
218
+ adapter: Ast::Crispr::Markdown::Markly.adapter,
219
+ owner_scope: :html_details,
220
+ selector_kind: :html_details,
221
+ selection_intent: :predicate_filter,
222
+ include_trailing_gap: false
223
+ ).merge(options),
224
+ locate: lambda do |context|
225
+ context.structural_owners(owner_scope: :html_details).filter_map do |owner|
226
+ next if summary_text && owner.summary_text.to_s.strip != summary_text.to_s.strip
227
+
228
+ Ast::Crispr::Match.new(
229
+ node: owner,
230
+ start_line: owner.location.start_line,
231
+ end_line: owner.location.end_line,
232
+ metadata: {
233
+ start_boundary: :owner_start,
234
+ end_boundary: :owner_end,
235
+ payload_kind: :structural_owner_body,
236
+ summary_text: owner.summary_text
237
+ }
238
+ )
239
+ end
240
+ end
241
+ )
242
+ end
243
+
204
244
  def list_item(text: nil, id: nil, limit: nil, metadata: {}, **options)
205
245
  Ast::Crispr::OwnerSelector.new(
206
246
  id: id || ['list_item', text].compact.join(':'),
@@ -335,6 +375,65 @@ module Ast
335
375
  end
336
376
  end
337
377
 
378
+ HtmlDetailsOwner = Struct.new(:location, :summary_text, :source, keyword_init: true)
379
+
380
+ # Markly exposes raw HTML as separate AST blocks rather than a nested HTML
381
+ # tree, so group the parser-owned blocks into selectable details owners.
382
+ def self.html_details_owners(analysis)
383
+ statements = Array(analysis.statements)
384
+ html_blocks = statements.filter_map do |statement|
385
+ next unless statement.respond_to?(:merge_type) && statement.merge_type == :html_block
386
+
387
+ position = statement.source_position
388
+ next unless position
389
+
390
+ {
391
+ start_line: position[:start_line],
392
+ end_line: position[:end_line]
393
+ }
394
+ end
395
+
396
+ html_blocks.filter_map do |opening|
397
+ opening_source = analysis.source_range(opening[:start_line], opening[:end_line])
398
+ next unless opening_source.lines.any? do |line|
399
+ stripped = line.lstrip
400
+ stripped.start_with?('<details>') || stripped.start_with?('<details ')
401
+ end
402
+
403
+ closing = html_blocks.drop_while { |candidate| candidate != opening }.drop(1).find do |candidate|
404
+ source = analysis.source_range(candidate[:start_line], candidate[:end_line])
405
+ source.lines.any? { |line| line.lstrip.start_with?('</details>') }
406
+ end
407
+ next unless closing
408
+
409
+ source = analysis.source_range(opening[:start_line], closing[:end_line])
410
+ summary_text = html_summary_text(source)
411
+ next if summary_text.empty?
412
+
413
+ HtmlDetailsOwner.new(
414
+ location: ::Markdown::Merge::FileAnalysis::Location.new(
415
+ start_line: opening[:start_line],
416
+ end_line: closing[:end_line]
417
+ ),
418
+ summary_text: summary_text,
419
+ source: source
420
+ )
421
+ end
422
+ end
423
+
424
+ def self.html_summary_text(source)
425
+ open_tag_start = source.index('<summary')
426
+ return '' unless open_tag_start
427
+
428
+ open_tag_end = source.index('>', open_tag_start)
429
+ return '' unless open_tag_end
430
+
431
+ close_tag_start = source.index('</summary>', open_tag_end)
432
+ return '' unless close_tag_start
433
+
434
+ source[(open_tag_end + 1)...close_tag_start].to_s.strip
435
+ end
436
+
338
437
  Targets = Selectors
339
438
 
340
439
  class << self
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ast-crispr-markdown-markly
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.1.1
4
+ version: 7.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter H. Boling
@@ -43,42 +43,42 @@ dependencies:
43
43
  requirements:
44
44
  - - '='
45
45
  - !ruby/object:Gem::Version
46
- version: 7.1.1
46
+ version: 7.1.3
47
47
  type: :runtime
48
48
  prerelease: false
49
49
  version_requirements: !ruby/object:Gem::Requirement
50
50
  requirements:
51
51
  - - '='
52
52
  - !ruby/object:Gem::Version
53
- version: 7.1.1
53
+ version: 7.1.3
54
54
  - !ruby/object:Gem::Dependency
55
55
  name: markdown-merge
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - '='
59
59
  - !ruby/object:Gem::Version
60
- version: 7.1.1
60
+ version: 7.1.3
61
61
  type: :runtime
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - '='
66
66
  - !ruby/object:Gem::Version
67
- version: 7.1.1
67
+ version: 7.1.3
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: markly-merge
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - '='
73
73
  - !ruby/object:Gem::Version
74
- version: 7.1.1
74
+ version: 7.1.3
75
75
  type: :runtime
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - '='
80
80
  - !ruby/object:Gem::Version
81
- version: 7.1.1
81
+ version: 7.1.3
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: version_gem
84
84
  requirement: !ruby/object:Gem::Requirement
@@ -105,20 +105,20 @@ dependencies:
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: '2.5'
108
+ version: '3.0'
109
109
  - - ">="
110
110
  - !ruby/object:Gem::Version
111
- version: 2.5.17
111
+ version: 3.0.0
112
112
  type: :development
113
113
  prerelease: false
114
114
  version_requirements: !ruby/object:Gem::Requirement
115
115
  requirements:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
- version: '2.5'
118
+ version: '3.0'
119
119
  - - ">="
120
120
  - !ruby/object:Gem::Version
121
- version: 2.5.17
121
+ version: 3.0.0
122
122
  - !ruby/object:Gem::Dependency
123
123
  name: bundler-audit
124
124
  requirement: !ruby/object:Gem::Requirement
@@ -196,7 +196,7 @@ dependencies:
196
196
  version: '3.2'
197
197
  - - ">="
198
198
  - !ruby/object:Gem::Version
199
- version: 3.2.0
199
+ version: 3.2.2
200
200
  type: :development
201
201
  prerelease: false
202
202
  version_requirements: !ruby/object:Gem::Requirement
@@ -206,7 +206,7 @@ dependencies:
206
206
  version: '3.2'
207
207
  - - ">="
208
208
  - !ruby/object:Gem::Version
209
- version: 3.2.0
209
+ version: 3.2.2
210
210
  - !ruby/object:Gem::Dependency
211
211
  name: kettle-test
212
212
  requirement: !ruby/object:Gem::Requirement
@@ -236,7 +236,7 @@ dependencies:
236
236
  version: '3.2'
237
237
  - - ">="
238
238
  - !ruby/object:Gem::Version
239
- version: 3.2.4
239
+ version: 3.2.5
240
240
  type: :development
241
241
  prerelease: false
242
242
  version_requirements: !ruby/object:Gem::Requirement
@@ -246,7 +246,7 @@ dependencies:
246
246
  version: '3.2'
247
247
  - - ">="
248
248
  - !ruby/object:Gem::Version
249
- version: 3.2.4
249
+ version: 3.2.5
250
250
  - !ruby/object:Gem::Dependency
251
251
  name: ruby-progressbar
252
252
  requirement: !ruby/object:Gem::Requirement
@@ -321,10 +321,10 @@ licenses:
321
321
  - PolyForm-Small-Business-1.0.0
322
322
  metadata:
323
323
  homepage_uri: https://structuredmerge.org
324
- source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.1
325
- changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.1/CHANGELOG.md
324
+ source_code_uri: https://github.com/structuredmerge/structuredmerge-ruby/tree/v7.1.3
325
+ changelog_uri: https://github.com/structuredmerge/structuredmerge-ruby/blob/v7.1.3/CHANGELOG.md
326
326
  bug_tracker_uri: https://github.com/structuredmerge/structuredmerge-ruby/issues
327
- documentation_uri: https://www.rubydoc.info/gems/ast-crispr-markdown-markly/7.1.1
327
+ documentation_uri: https://www.rubydoc.info/gems/ast-crispr-markdown-markly/7.1.3
328
328
  funding_uri: https://github.com/sponsors/pboling
329
329
  wiki_uri: https://github.com/structuredmerge/structuredmerge-ruby/wiki
330
330
  news_uri: https://www.railsbling.com/tags/ast-crispr-markdown-markly
metadata.gz.sig CHANGED
Binary file