asciidoctor-reducer 1.1.1 → 1.1.2

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: 5a1fcd2f167e66e18a7876694575d92c1d4cda20b0f1191d6f029d32c888c03d
4
- data.tar.gz: 9dd7507a5fe67295f51590f890196cc3b98cb32dbf5cdb61e1d15396caf34143
3
+ metadata.gz: d79dee7d3fe04a10fac4e4ea7ff50a564bc915cd20be9ccc9bfa21b41e2ab836
4
+ data.tar.gz: a830fd2dd521f0e2154a8d46917278254eec564d6ede76ba07d147581a2a7414
5
5
  SHA512:
6
- metadata.gz: efd6d82a88c4d6b1fdb4abd2f5b72b3a03df186a3cac990736ad5e199d9eb4a2e42360caff8cd40c3d71c5ad24bf2b44ae4a64187e38e837298380656fb8128b
7
- data.tar.gz: 7a365765f4685d936f2f7b06aaf015261a25a7910a5a6f3773cb01a6c2a90210a79586aa39546578dfd4971cd66b27c01e7016af6aa7cd264e88282069cc5421
6
+ metadata.gz: 77dbc3cd2f39503f85093edce50bb32d9da44c700de3c61558ddfbd9c2d3b7bfc5e0cb4e05d9705e460d92d4da30555c1bbf9d90a54cb19176ffdceb2711cf8c
7
+ data.tar.gz: 3228ea887ee92bf585258dae1ec3dc120309f3d1274c8ddc90558a25473a72e1bfa2c20074fdb8b1033db90730f558c45967457279660d6782b6fa4567d7e1ee
data/CHANGELOG.adoc CHANGED
@@ -4,6 +4,17 @@
4
4
  This document provides a curated view of the changes to Asciidoctor Reducer in each release.
5
5
  For a detailed view of what has changed, refer to the {url-repo}/commits/main[commit history] on GitHub.
6
6
 
7
+ == 1.1.2 (2025-05-09) - @mojavelinux
8
+
9
+ === Fixed
10
+
11
+ * Don't define reader for source_header_attributes instance variable if already defined
12
+ * Only catch RangeError when flattening list when using Opal runtime
13
+
14
+ === Details
15
+
16
+ {url-repo}/releases/tag/v1.1.2[git tag] | {url-repo}/compare/v1.1.1\...v1.1.2[full diff]
17
+
7
18
  == 1.1.1 (2025-03-27) - @mojavelinux
8
19
 
9
20
  === Fixed
data/README.adoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = {project-name}
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
3
- v1.1.1, 2025-03-27
3
+ v1.1.2, 2025-05-09
4
4
  :idprefix:
5
5
  :idseparator: -
6
6
  ifndef::env-github[:icons: font]
@@ -50,7 +50,7 @@ module Asciidoctor::Reducer
50
50
  private
51
51
 
52
52
  def write doc, to
53
- return doc unless to && to != '/dev/null'
53
+ return doc unless to && to != ::File::NULL
54
54
  output = doc.source
55
55
  return output if to == ::String
56
56
  output += LF unless output.empty?
@@ -3,10 +3,11 @@
3
3
  module Asciidoctor::Reducer
4
4
  module HeaderAttributeTracker
5
5
  def self.extended instance
6
+ return if instance.singleton_class.method_defined? :source_header_attributes
6
7
  instance.singleton_class.send :attr_reader, :source_header_attributes
7
8
  end
8
9
 
9
- def finalize_header(*) # rubocop:disable Style/MethodDefParentheses
10
+ def finalize_header(*)
10
11
  @source_header_attributes = @attributes_modified.each_with_object({}) do |name, accum|
11
12
  accum[name] = @attributes[name]
12
13
  end
@@ -5,7 +5,7 @@ module Asciidoctor::Reducer
5
5
  def process doc
6
6
  if doc.extensions.groups[:reducer]
7
7
  unless (includes = doc.catalog[:includes].map {|name, val| val ? name : %(~#{name}) }).empty?
8
- doc.source_lines.concat ['', %(//# includes=#{includes.join ','})]
8
+ doc.source_lines.push '', %(//# includes=#{includes.join ','})
9
9
  end
10
10
  elsif (last_line = doc.source_lines[-1])&.start_with? '//# includes='
11
11
  doc.catalog[:includes].update ((last_line.slice 13, last_line.length).split ',')
@@ -49,28 +49,34 @@ module Asciidoctor::Reducer
49
49
 
50
50
  private
51
51
 
52
- def flatten input_list
53
- input_list.flatten
54
- rescue ::Exception => e # rubocop:disable Lint/RescueException,Lint/UselessAssignment
55
- raise unless %x(e.name) == 'RangeError'
56
- result = []
57
- stack = [[0, input_list, input_list.length]]
58
- until stack.empty?
59
- idx, list, len = stack.pop
60
- while idx < len
61
- if Array === (item = list[idx])
62
- if (next_idx = idx + 1) < len
63
- stack << [next_idx, list, len]
52
+ if RUBY_ENGINE == 'opal'
53
+ def flatten input_list
54
+ input_list.flatten
55
+ rescue ::Exception => e # rubocop:disable Lint/RescueException
56
+ raise unless e && %x(e.name) == 'RangeError'
57
+ result = []
58
+ stack = [[0, input_list, input_list.length]]
59
+ until stack.empty?
60
+ idx, list, len = stack.pop
61
+ while idx < len
62
+ if Array === (item = list[idx])
63
+ if (next_idx = idx + 1) < len
64
+ stack << [next_idx, list, len]
65
+ end
66
+ idx = 0
67
+ len = (list = item).length
68
+ else
69
+ result << item
70
+ idx += 1
64
71
  end
65
- idx = 0
66
- len = (list = item).length
67
- else
68
- result << item
69
- idx += 1
70
72
  end
71
73
  end
74
+ result
75
+ end
76
+ else
77
+ def flatten input_list
78
+ input_list.flatten
72
79
  end
73
- result
74
80
  end
75
81
  end
76
82
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Reducer
5
- VERSION = '1.1.1'
5
+ VERSION = '1.1.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-reducer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-27 00:00:00.000000000 Z
11
+ date: 2025-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor