asciidoctor-reducer 1.0.5 → 1.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8618df3cfe6cc9e6ed5d93fd1cc9a29c6026f2fa9b8fd017098c37cebff3eb05
4
- data.tar.gz: c1bba0fcd19f6c09176c91caf72f46c338d8116b802c1992b10629e0e776f09a
3
+ metadata.gz: '0315811ef24fa88a755aa6973e86aca45929a43416020d2f82afa7ef1e664fd9'
4
+ data.tar.gz: 745ee8bc00aba042843abb05bb22a8ad93a50dc9de7090bd946c82b3333b19d3
5
5
  SHA512:
6
- metadata.gz: 52e0007d74c7495f44b89bc12ba4c0ab7e378d9050ce069f28655d580deae8268b162e8e223fc21bf05e9d2583355493abb654a781ae22768b8c3e762fb32d7f
7
- data.tar.gz: 01125c00be7703eaeefe0e2b160c5df2cda937111444b986a6f86df4f02ec36f431e0cdf22b48aa8ea808c2094ccb482dcb22ff26999899d87ef0f49686bcd5c
6
+ metadata.gz: a0eca70526db73201588d3b9154207b7ec1bdf30f41c8799ee6a88a36091e4906b4ce00ef183939be46c3ed8cd78778119e206585e01648fa20eff48c16cd6e9
7
+ data.tar.gz: 3c97e30588293c5e599cf26d6dff4b142936582bf8544f9d6f577a5ae6a000e1b4e1a835fd33dbaa22f044c863f51e827aa42f56ab6d758a1acf3b5485bc938d
data/CHANGELOG.adoc CHANGED
@@ -4,11 +4,21 @@
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.0.6 (2024-02-12) - @mojavelinux
8
+
9
+ === Fixed
10
+
11
+ * Reduce single line conditionals inside file included by include directive with `leveloffset` attribute (#53)
12
+
13
+ === Details
14
+
15
+ {url-repo}/releases/tag/v1.0.6[git tag] | {url-repo}/compare/v1.0.5\...v1.0.6[full diff]
16
+
7
17
  == 1.0.5 (2022-10-15) - @mojavelinux
8
18
 
9
19
  === Changed
10
20
 
11
- * insert `role=include` into link macro that replaces include directive more carefully
21
+ * Insert `role=include` into link macro that replaces include directive more carefully
12
22
 
13
23
  === Details
14
24
 
@@ -18,7 +28,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
18
28
 
19
29
  === Changed
20
30
 
21
- * don't add role to link that replaces include directive if role is already present
31
+ * Don't add role to link that replaces include directive if role is already present
22
32
 
23
33
  === Details
24
34
 
data/README.adoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = {project-name}
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
3
- v1.0.5, 2022-10-15
3
+ v1.0.6, 2024-02-12
4
4
  :idprefix:
5
5
  :idseparator: -
6
6
  ifndef::env-github[:icons: font]
@@ -83,6 +83,10 @@ Thus, to use the command, pass the AsciiDoc file as the sole argument:
83
83
 
84
84
  $ asciidoctor-reducer input.adoc
85
85
 
86
+ If you only want AsciiDoctor Reducer to process include directives, leaving preprocessor conditional directives untouched, add the `--preserve-conditionals` option:
87
+
88
+ $ asciidoctor-reducer --preserve-conditionals input.adoc
89
+
86
90
  By default, the command will output the reduced AsciiDoc document to the terminal (via stdout).
87
91
  To write the output to a file, specify an output file using the `-o` option:
88
92
 
@@ -217,7 +221,7 @@ To use the include mapper when using the API, first require the extension:
217
221
 
218
222
  [,ruby]
219
223
  ----
220
- require 'asciidocotor/reducer/include_mapper/extension'
224
+ require 'asciidoctor/reducer/include_mapper/extension'
221
225
  ----
222
226
 
223
227
  You then need to register the extension when reducing the document:
@@ -243,7 +247,7 @@ You can also register the extension globally:
243
247
 
244
248
  [,ruby]
245
249
  ----
246
- require 'asciidocotor/reducer/include_mapper'
250
+ require 'asciidoctor/reducer/include_mapper'
247
251
  ----
248
252
 
249
253
  In this case, you don't have to pass it to the API explicitly.
@@ -284,10 +288,11 @@ jobs:
284
288
  runs-on: ubuntu-latest
285
289
  steps:
286
290
  - name: Checkout Repository
287
- uses: actions/checkout@v2
291
+ uses: actions/checkout@v3
288
292
  - name: Install Asciidoctor Reducer
289
293
  run: sudo gem install asciidoctor-reducer
290
294
  - name: Reduce README
295
+ # to preserve preprocessor conditionals, add the --preserve-conditionals option
291
296
  run: asciidoctor-reducer -o README.adoc README-source.adoc
292
297
  - name: Commit and Push README
293
298
  uses: EndBug/add-and-commit@v9
@@ -335,7 +340,7 @@ The tests are based on RSpec.
335
340
 
336
341
  You can run all of the tests using Rake:
337
342
 
338
- $ bundle exec spec
343
+ $ bundle exec rake spec
339
344
 
340
345
  For more fine-grained control, you can also run the tests directly using RSpec:
341
346
 
@@ -376,7 +381,7 @@ RSpec will only run the specifications that have a description containing the te
376
381
 
377
382
  To generate a code coverage report when running tests using simplecov, set the `COVERAGE` environment variable as follows when running the tests:
378
383
 
379
- $ COVERAGE=deep bundle exec rake
384
+ $ COVERAGE=deep bundle exec rake spec
380
385
 
381
386
  You'll see a total coverage score, a detailed coverage report, and a link to HTML report in the output.
382
387
  The HTML report helps you understand which lines and branches were missed, if any.
@@ -34,6 +34,6 @@ Gem::Specification.new do |s|
34
34
 
35
35
  s.add_runtime_dependency 'asciidoctor', '~> 2.0'
36
36
 
37
- s.add_development_dependency 'rake', '~> 13.0.0'
38
- s.add_development_dependency 'rspec', '~> 3.11.0'
37
+ s.add_development_dependency 'rake', '~> 13.1.0'
38
+ s.add_development_dependency 'rspec', '~> 3.13.0'
39
39
  end
@@ -10,17 +10,17 @@ module Asciidoctor::Reducer
10
10
  return result if @skipping && skip_active
11
11
  curr_inc_replacement = @include_replacements.current
12
12
  drop = curr_inc_replacement[:drop] ||= []
13
- directive_lineno -= (curr_inc_replacement[:offset] ||= 0)
13
+ adjusted_directive_lineno = directive_lineno - (curr_inc_replacement[:offset] ||= 0)
14
14
  if (depth_change = @conditional_stack.size - depth) < 0
15
15
  if skip_active
16
- drop.push(*(drop.pop..directive_lineno))
16
+ drop.push(*(drop.pop..adjusted_directive_lineno))
17
17
  else
18
- drop << directive_lineno
18
+ drop << adjusted_directive_lineno
19
19
  end
20
20
  elsif depth_change > 0 || directive_lineno == @lineno
21
- drop << directive_lineno
21
+ drop << adjusted_directive_lineno
22
22
  else
23
- drop << [directive_lineno, text]
23
+ drop << [adjusted_directive_lineno, text]
24
24
  end
25
25
  result
26
26
  end
@@ -38,13 +38,13 @@ module Asciidoctor::Reducer
38
38
  result
39
39
  end
40
40
 
41
+ private
42
+
41
43
  def pop_include
42
44
  @include_replacements.up unless @x_reducer[:include_pushed]
43
45
  super
44
46
  end
45
47
 
46
- private
47
-
48
48
  def push_include_replacement lineno, lines, offset, unresolved = false
49
49
  (inc_replacements = @include_replacements) << {
50
50
  into: inc_replacements.pointer,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Reducer
5
- VERSION = '1.0.5'
5
+ VERSION = '1.0.6'
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.0.5
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-15 00:00:00.000000000 Z
11
+ date: 2024-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 13.0.0
33
+ version: 13.1.0
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 13.0.0
40
+ version: 13.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 3.11.0
47
+ version: 3.13.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 3.11.0
54
+ version: 3.13.0
55
55
  description: A tool that reduces an AsciiDoc document containing preprocessor directives
56
56
  (includes and conditionals) to a single AsciiDoc document by expanding all includes
57
57
  and evaluating all conditionals.
@@ -101,7 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
101
  - !ruby/object:Gem::Version
102
102
  version: '0'
103
103
  requirements: []
104
- rubygems_version: 3.3.7
104
+ rubygems_version: 3.3.26
105
105
  signing_key:
106
106
  specification_version: 4
107
107
  summary: Reduces an AsciiDoc document containing includes and conditionals to a single