asciidoctor-reducer 1.0.0.alpha.10 → 1.0.0

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: 425f7379b4e69cb9487a2c2affcd77bd7cc548bd7818b073334f45a64f853f9c
4
- data.tar.gz: b3a85d94ee64d2ecee967a3a88a7ce4295af83eda84c76f852df24fcb312b9ee
3
+ metadata.gz: 28901fa8f69c6cffe25cac501f7242980cd50dce1ad0586ccff44ed66c4eee30
4
+ data.tar.gz: a8c80c18c767ba36a0c3642b69e166532c191d0f5772e884fb86d3341dc1889b
5
5
  SHA512:
6
- metadata.gz: f48fffea4f5dd09c1cec0d375a1fe1050144c5e723802413e2de3191c57e221f0482f210addb533d4b7ddac23a7142ee5b75721e9d5b1269e001d17da97d5726
7
- data.tar.gz: a4538dc754a1f4b82aa0fd4bb8b89ed848da9b3932430dbb2c51c3b443d08c0d5a4c345925be75cbbee0c0fa1cf8dce08e60d42d9a27d3b2ddb2b5ad9c30f5c6
6
+ metadata.gz: b00cbaa7e4d145ed571dfe282f4b440dd61472feabdd79338ca27e2ceaf795593e0efb7e3f86cb05d021176328d4a20a37adf4f6ffdefb3b30fad480672e2821
7
+ data.tar.gz: a923404fe5ed452e3a4145ba15f8512a441c6d8b47986a22bc1485edc6c8672f28f31dba30ad2e224ae2a3f98d7b383b1d5cefa81ae70af7779205ea300d6d1a
data/CHANGELOG.adoc CHANGED
@@ -1,9 +1,35 @@
1
1
  = Asciidoctor Reducer Changelog
2
2
  :url-repo: https://github.com/asciidoctor/asciidoctor-reducer
3
3
 
4
- This document provides a high-level view of the changes to the Asciidoctor Reducer by release.
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.0 (2022-04-22) - @mojavelinux
8
+
9
+ _No changes since previous release._
10
+
11
+ === Details
12
+
13
+ {url-repo}/releases/tag/v1.0.0[git tag] | {url-repo}/compare/v1.0.0-rc.1\...v1.0.0[full diff]
14
+
15
+ == 1.0.0-rc.1 (2022-04-22) - @mojavelinux
16
+
17
+ _No changes since previous release._
18
+
19
+ === Details
20
+
21
+ {url-repo}/releases/tag/v1.0.0-rc.1[git tag] | {url-repo}/compare/v1.0.0-beta.1\...v1.0.0-rc.1[full diff]
22
+
23
+ == 1.0.0-beta.1 (2022-04-21) - @mojavelinux
24
+
25
+ === Changed
26
+
27
+ * Add names of include files which have been included partially in include mapping comment and prefix names with ~
28
+
29
+ === Details
30
+
31
+ {url-repo}/releases/tag/v1.0.0-beta.1[git tag] | {url-repo}/compare/v1.0.0.alpha.10\...v1.0.0-beta.1[full diff]
32
+
7
33
  == 1.0.0.alpha.10 (2022-04-21) - @mojavelinux
8
34
 
9
35
  === Changed
@@ -59,7 +85,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
59
85
 
60
86
  === Details
61
87
 
62
- {url-repo}/releases/tag/v1.0.0.alpha.8[git tag]
88
+ {url-repo}/releases/tag/v1.0.0.alpha.8[git tag] | {url-repo}/compare/v1.0.0.alpha.7\...v1.0.0.alpha.8[full diff]
63
89
 
64
90
  == 1.0.0.alpha.7 (2022-02-14) - @mojavelinux
65
91
 
@@ -82,7 +108,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
82
108
 
83
109
  === Details
84
110
 
85
- {url-repo}/releases/tag/v1.0.0.alpha.7[git tag]
111
+ {url-repo}/releases/tag/v1.0.0.alpha.7[git tag] | {url-repo}/compare/v1.0.0.alpha.6\...v1.0.0.alpha.7[full diff]
86
112
 
87
113
  == 1.0.0.alpha.6 (2022-02-10) - @mojavelinux
88
114
 
@@ -106,7 +132,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
106
132
 
107
133
  === Details
108
134
 
109
- {url-repo}/releases/tag/v1.0.0.alpha.6[git tag]
135
+ {url-repo}/releases/tag/v1.0.0.alpha.6[git tag] | {url-repo}/compare/v1.0.0.alpha.5\...v1.0.0.alpha.6[full diff]
110
136
 
111
137
  == 1.0.0.alpha.5 (2022-02-06) - @mojavelinux
112
138
 
@@ -123,7 +149,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
123
149
 
124
150
  === Details
125
151
 
126
- {url-repo}/releases/tag/v1.0.0.alpha.5[git tag]
152
+ {url-repo}/releases/tag/v1.0.0.alpha.5[git tag] | {url-repo}/compare/v1.0.0.alpha.4\...v1.0.0.alpha.5[full diff]
127
153
 
128
154
  == 1.0.0.alpha.4 (2022-02-03) - @mojavelinux
129
155
 
@@ -133,7 +159,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
133
159
 
134
160
  === Details
135
161
 
136
- {url-repo}/releases/tag/v1.0.0.alpha.4[git tag]
162
+ {url-repo}/releases/tag/v1.0.0.alpha.4[git tag] | {url-repo}/compare/v1.0.0.alpha.3\...v1.0.0.alpha.4[full diff]
137
163
 
138
164
  == 1.0.0.alpha.3 (2022-02-02) - @mojavelinux
139
165
 
@@ -146,7 +172,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
146
172
 
147
173
  === Details
148
174
 
149
- {url-repo}/releases/tag/v1.0.0.alpha.3[git tag]
175
+ {url-repo}/releases/tag/v1.0.0.alpha.3[git tag] | {url-repo}/compare/v1.0.0.alpha.2\...v1.0.0.alpha.3[full diff]
150
176
 
151
177
  == 1.0.0.alpha.2 (2022-01-27) - @mojavelinux
152
178
 
@@ -169,7 +195,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
169
195
 
170
196
  === Details
171
197
 
172
- {url-repo}/releases/tag/v1.0.0.alpha.2[git tag]
198
+ {url-repo}/releases/tag/v1.0.0.alpha.2[git tag] | {url-repo}/compare/v1.0.0.alpha.1\...v1.0.0.alpha.2[full diff]
173
199
 
174
200
  == 1.0.0.alpha.1 (2022-01-12) - @mojavelinux
175
201
 
data/README.adoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = {project-name}
2
2
  Dan Allen <https://github.com/mojavelinux[@mojavelinux]>
3
- v1.0.0.alpha.10, 2022-04-21
3
+ v1.0.0, 2022-04-22
4
4
  :idprefix:
5
5
  :idseparator: -
6
6
  ifndef::env-github[:icons: font]
@@ -16,9 +16,9 @@ endif::[]
16
16
  :url-rvm: https://rvm.io
17
17
  :url-repo: https://github.com/asciidoctor/{project-handle}
18
18
 
19
- {project-name} is a tool that reduces an AsciiDoc document that contains includes to a single AsciiDoc document by expanding any includes reachable from the parent document.
20
- The tool also applies preprocessor conditionals (unless the option to preserve them is specified), leaving behind only the selected lines.
21
- If the document does not contain any preprocessor directives, the tool returns the original source.
19
+ {project-name} is a tool that reduces an AsciiDoc document containing include directives to a single AsciiDoc document by expanding the includes reachable from the parent document.
20
+ Additionally, the tool evaluates preprocessor conditionals (unless the option to preserve them is enabled), only keeping those lines from conditions which are true.
21
+ If the document does not contain any preprocessor directives, the tool returns the unmodified source.
22
22
 
23
23
  == Prerequisites
24
24
 
@@ -38,7 +38,7 @@ We generally recommend using RVM as it allows you to install gems without requir
38
38
 
39
39
  You can install the latest version of the gem using the following command:
40
40
 
41
- $ gem install asciidoctor-reducer --pre
41
+ $ gem install asciidoctor-reducer
42
42
 
43
43
  Installing this gem makes the `asciidoctor-reducer` command available on your $PATH.
44
44
  You can also require the gem into the Ruby runtime to use it as a library or Asciidoctor extension.
@@ -7,8 +7,8 @@ end
7
7
  Gem::Specification.new do |s|
8
8
  s.name = 'asciidoctor-reducer'
9
9
  s.version = Asciidoctor::Reducer::VERSION
10
- s.summary = 'Reduces a composite AsciiDoc document containing includes and conditionals to a single AsciiDoc document.'
11
- s.description = 'A tool that reduces a composite AsciiDoc document containing preprocessor directives (includes and conditionals) to a single AsciiDoc document by expanding the includes and applying the conditionals.'
10
+ s.summary = 'Reduces an AsciiDoc document containing includes and conditionals to a single AsciiDoc document.'
11
+ s.description = 'A tool that reduces an AsciiDoc document containing preprocessor directives (includes and conditionals) to a single AsciiDoc document by expanding all includes and evaluating all conditionals.'
12
12
  s.authors = ['Dan Allen']
13
13
  s.email = 'dan.j.allen@gmail.com'
14
14
  s.homepage = 'https://asciidoctor.org'
@@ -7,6 +7,15 @@ module Asciidoctor::Reducer
7
7
  autoload :VERSION, (::File.join __dir__, 'version.rb')
8
8
 
9
9
  class << self
10
+ # Reduces the AsciiDoc source and either returns the reduced Asciidoctor::Document or writes the source to a file.
11
+ #
12
+ # This method accepts all the options supported by Asciidoctor.load.
13
+ #
14
+ # @param input [String, File, Pathname] the AsciiDoc source to reduce.
15
+ # @param opts [Hash] additional options to configure the behavior of the reducer.
16
+ # @option opts [File, Pathname, Class] :to (nil) the target to which to write the reduced source.
17
+ #
18
+ # @return [Asciidoctor::Document, nil] the reduced document object or nil if the :to option is specified.
10
19
  def reduce input, opts = {}
11
20
  opts = opts&.merge || {}
12
21
  if (extension_registry = Extensions.prepare_registry opts[:extension_registry] || opts[:extensions])
@@ -25,6 +34,15 @@ module Asciidoctor::Reducer
25
34
  write doc, to
26
35
  end
27
36
 
37
+ # Reduces the AsciiDoc file and either returns the reduced Asciidoctor::Document or writes the source to a file.
38
+ #
39
+ # This method accepts all the options supported by Asciidoctor.load.
40
+ #
41
+ # @param input_file [String] the path of the AsciiDoc file to reduce.
42
+ # @param opts [Hash] additional options to configure the behavior of the reducer.
43
+ # @option opts [File, Pathname, Class] :to (nil) the target to which to write the reduced source.
44
+ #
45
+ # @return [Asciidoctor::Document, nil] the reduced document object or nil if the :to option is specified.
28
46
  def reduce_file input_file, opts = {}
29
47
  reduce (::Pathname.new input_file), opts
30
48
  end
@@ -4,11 +4,12 @@ module Asciidoctor::Reducer
4
4
  class IncludeMapper < ::Asciidoctor::Extensions::TreeProcessor
5
5
  def process doc
6
6
  if doc.extensions.groups[:reducer]
7
- unless (includes = doc.catalog[:includes].select {|_, v| v }.keys).empty?
7
+ unless (includes = doc.catalog[:includes].map {|name, val| val ? name : %(~#{name}) }).empty?
8
8
  doc.source_lines.concat ['', %(//# includes=#{includes.join ','})]
9
9
  end
10
10
  elsif (last_line = doc.source_lines[-1])&.start_with? '//# includes='
11
- doc.catalog[:includes].update ((last_line.slice 13, last_line.length).split ',').map {|it| [it, true] }.to_h
11
+ doc.catalog[:includes].update ((last_line.slice 13, last_line.length).split ',')
12
+ .map {|it| [(fragment = it.chr == '~') ? (it.slice 1, it.length) : it, !fragment] }.to_h
12
13
  end
13
14
  doc
14
15
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Asciidoctor
4
4
  module Reducer
5
- VERSION = '1.0.0.alpha.10'
5
+ VERSION = '1.0.0'
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.0.alpha.10
4
+ version: 1.0.0
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-04-21 00:00:00.000000000 Z
11
+ date: 2022-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: asciidoctor
@@ -52,9 +52,9 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.11.0
55
- description: A tool that reduces a composite AsciiDoc document containing preprocessor
56
- directives (includes and conditionals) to a single AsciiDoc document by expanding
57
- the includes and applying the conditionals.
55
+ description: A tool that reduces an AsciiDoc document containing preprocessor directives
56
+ (includes and conditionals) to a single AsciiDoc document by expanding all includes
57
+ and evaluating all conditionals.
58
58
  email: dan.j.allen@gmail.com
59
59
  executables:
60
60
  - asciidoctor-reducer
@@ -97,13 +97,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
97
  version: '0'
98
98
  required_rubygems_version: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - ">"
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
- version: 1.3.1
102
+ version: '0'
103
103
  requirements: []
104
104
  rubygems_version: 3.3.7
105
105
  signing_key:
106
106
  specification_version: 4
107
- summary: Reduces a composite AsciiDoc document containing includes and conditionals
108
- to a single AsciiDoc document.
107
+ summary: Reduces an AsciiDoc document containing includes and conditionals to a single
108
+ AsciiDoc document.
109
109
  test_files: []