asciidoctor-reducer 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.adoc +10 -0
- data/README.adoc +1 -1
- data/lib/asciidoctor/reducer/conditional_directive_tracker.rb +3 -1
- data/lib/asciidoctor/reducer/include_directive_tracker.rb +6 -4
- data/lib/asciidoctor/reducer/tree_processor.rb +1 -1
- data/lib/asciidoctor/reducer/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b5316a1e0a22871599401171fc8f5104e4a03cf09598eacee8670153354e6050
|
4
|
+
data.tar.gz: 02cc09578b9798e53f3e8a23f81b2e051ef2b6714c39bee99d043a6cbee2acc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2ef54d4a37f4c1f2205cb191735a1d6462ad271faa75db4ea87305c5ba25f2ba08885057f5c56006703ad745fc2c55928ac0c6db9205e9ee35284fab245f395
|
7
|
+
data.tar.gz: '0018183fd91c359a67ad0a6e5b60901f5f868bc4223bd9fc27c639eb5fb05a684c938480507a9ff445bdd00ad260ff385c29d68a6359c2498cc6a4d9cee0320a'
|
data/CHANGELOG.adoc
CHANGED
@@ -4,6 +4,16 @@
|
|
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.2 (2022-05-09) - @mojavelinux
|
8
|
+
|
9
|
+
=== Fixed
|
10
|
+
|
11
|
+
* Replace include and conditional directives inside a file that has been included partially (i.e., has an offset) (#43)
|
12
|
+
|
13
|
+
=== Details
|
14
|
+
|
15
|
+
{url-repo}/releases/tag/v1.0.2[git tag] | {url-repo}/compare/v1.0.1\...v1.0.2[full diff]
|
16
|
+
|
7
17
|
== 1.0.1 (2022-05-08) - @mojavelinux
|
8
18
|
|
9
19
|
=== Changed
|
data/README.adoc
CHANGED
@@ -8,7 +8,9 @@ module Asciidoctor::Reducer
|
|
8
8
|
directive_lineno = @lineno
|
9
9
|
result = super
|
10
10
|
return result if @skipping && skip_active
|
11
|
-
|
11
|
+
curr_inc_replacement = @include_replacements.current
|
12
|
+
drop = curr_inc_replacement[:drop] ||= []
|
13
|
+
directive_lineno -= (curr_inc_replacement[:offset] ||= 0)
|
12
14
|
if (depth_change = @conditional_stack.size - depth) < 0
|
13
15
|
if skip_active
|
14
16
|
drop.push(*(drop.pop..directive_lineno))
|
@@ -18,7 +18,7 @@ module Asciidoctor::Reducer
|
|
18
18
|
directive_lineno == @lineno && (unresolved = ln.start_with? 'link:')
|
19
19
|
ln = %(#{ln.slice 0, (ln.length - 1)}role=include])
|
20
20
|
end
|
21
|
-
push_include_replacement directive_lineno, (unresolved ? [ln] : []), unresolved
|
21
|
+
push_include_replacement directive_lineno, (unresolved ? [ln] : []), 0, unresolved
|
22
22
|
end
|
23
23
|
@x_reducer.clear
|
24
24
|
result
|
@@ -28,8 +28,9 @@ module Asciidoctor::Reducer
|
|
28
28
|
@x_reducer[:include_pushed] = true
|
29
29
|
directive_lineno = @lineno - 1 # we're below the include line, which is 1-based
|
30
30
|
prev_inc_depth = @include_stack.size
|
31
|
+
offset = lineno > 1 ? lineno - 1 : 0
|
31
32
|
result = super
|
32
|
-
push_include_replacement directive_lineno, (@include_stack.size > prev_inc_depth ? lines : [])
|
33
|
+
push_include_replacement directive_lineno, (@include_stack.size > prev_inc_depth ? lines : []), offset
|
33
34
|
result
|
34
35
|
end
|
35
36
|
|
@@ -40,12 +41,13 @@ module Asciidoctor::Reducer
|
|
40
41
|
|
41
42
|
private
|
42
43
|
|
43
|
-
def push_include_replacement lineno, lines, unresolved = false
|
44
|
+
def push_include_replacement lineno, lines, offset, unresolved = false
|
44
45
|
(inc_replacements = @include_replacements) << {
|
45
46
|
into: inc_replacements.pointer,
|
46
|
-
lineno: lineno,
|
47
|
+
lineno: lineno - (inc_replacements.current[:offset] ||= 0),
|
47
48
|
line: @x_reducer[:include_directive_line],
|
48
49
|
lines: lines,
|
50
|
+
offset: offset,
|
49
51
|
}
|
50
52
|
inc_replacements.to_end unless unresolved || lines.empty?
|
51
53
|
nil
|
@@ -8,7 +8,7 @@ module Asciidoctor::Reducer
|
|
8
8
|
inc_replacements.reverse_each do |it|
|
9
9
|
if (into = it[:into])
|
10
10
|
target_lines = inc_replacements[into][:lines]
|
11
|
-
# adds extra
|
11
|
+
# adds extra assurance that we're replacing the correct line
|
12
12
|
next unless target_lines[(idx = it[:lineno] - 1)] == it[:line]
|
13
13
|
end
|
14
14
|
lines = it[:lines]
|
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.
|
4
|
+
version: 1.0.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: 2022-05-
|
11
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: asciidoctor
|