asciidoctor-rhrev 1.2.0 → 1.2.1

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: ba4b787b526a584c23e8d5c890cfc0459711552efb13b11e483b2847706f018e
4
- data.tar.gz: 5e740bd4af7144bcc3ad461ddadfc402883354395f372c1336439e87d498547f
3
+ metadata.gz: 276f637c4b79aea05fbe85e5e1d094c589c6db123bd6e122550cb1c05c905665
4
+ data.tar.gz: 58d31c0cb4c0166751f8e4468869412fcbebfa77b97a7437ef18496a41a34965
5
5
  SHA512:
6
- metadata.gz: 9ad667cf9c86e5462ca177eae98fddad13335354c26083fb15cfe5639630b7044e0e623b7e5b1f5f069fe4689403e6c382246db47c7127aafe89d2f1fa204853
7
- data.tar.gz: fca906ea2b5256d3d141828ee39ef3298fb9420dbea437f424e6cac633035e8dec6463ca2bdd30c76d86c73e08125bb7620c94fdff4015970cc9b65fa837f764
6
+ metadata.gz: 8dd9503efa38605fef59b798d0013770e77c6770711305e56131dcc7bd46c835d969a708c2104f8e0141d41a5cab47218697f7433d9d14eeff0281ea3dc2a44f
7
+ data.tar.gz: 9c2c1967469f0f6330d7cf3c220cec2c701b7030fb849ee7f7da0b1189aced01dd3ec6068df7542dd350b33b6be4a47eb890651ba899d69fc113820df94e0e5f
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,9 @@
1
1
  = Changelog
2
2
 
3
+ == 1.2.1 (2026-07-07)
4
+
5
+ * Fix PDF change bars bleeding from a marked section/chapter into its child sections/chapters: a section's bar now always stops at its own content, right before the first nested subsection, regardless of whether that subsection is itself marked
6
+
3
7
  == 1.2.0 (2026-07-07)
4
8
 
5
9
  * Fix document-level `-all`/`-cover` entries being ignored for revisions with more than two segments (e.g. `1-2-0`): revisions are now discovered from `*-prevrev` attributes instead of enumerating `major-minor` pairs (PDF and HTML backends)
@@ -27,6 +27,7 @@ module Asciidoctor
27
27
  side: (doc.attr 'rhrev-change-bars-side'),
28
28
  }
29
29
  @change_bar_starts = {}
30
+ @change_bar_section_stack = []
30
31
  end
31
32
 
32
33
  # Resolved lazily on first ink: the theme (and @media/@folio_placement)
@@ -61,6 +62,25 @@ module Asciidoctor
61
62
  @change_bar_starts&.delete node
62
63
  end
63
64
 
65
+ # A section's bar covers only its own directly-owned content, not any
66
+ # nested child sections/chapters: as soon as a child section begins
67
+ # rendering, close out the bar of every still-open ancestor section
68
+ # right here, at the boundary between the parent's own content and
69
+ # its first child section.
70
+ def enter_change_bar_section node
71
+ return unless @change_bar_attr
72
+ @change_bar_section_stack.each do |ancestor|
73
+ next unless (start_pos = take_change_bar_start ancestor)
74
+ ink_change_bar start_pos, { page: page_number, cursor: cursor }
75
+ end
76
+ @change_bar_section_stack.push node
77
+ end
78
+
79
+ def exit_change_bar_section node
80
+ return unless @change_bar_attr
81
+ @change_bar_section_stack.pop
82
+ end
83
+
64
84
  # The offset measures the gap between the text edge and the near edge
65
85
  # of the bar. Sides recto/verso are determined by the physical page
66
86
  # number (honoring pdf-folio-placement inversion), matching prepress
@@ -74,7 +74,7 @@ module Asciidoctor
74
74
  # Skip collect during render if prescan already did it
75
75
  collect_revision_entries node unless @prescan_complete
76
76
  update_revision_entry_metadata node
77
-
77
+
78
78
  if node.id
79
79
  @anchor_catalog ||= {}
80
80
  @anchor_catalog[node.id] ||= {
@@ -85,12 +85,16 @@ module Asciidoctor
85
85
  level: node.level
86
86
  }
87
87
  @anchor_catalog[node.id][:dest] = { page: page_number, y: cursor }
88
-
88
+
89
89
  # Link destination to page for revision history
90
90
  revision_history.link_dest_to_page node.id, page_number, 1, y: cursor
91
91
  end
92
92
 
93
+ # Entering a section closes out any still-open ancestor change bars,
94
+ # so a marked section's bar never bleeds into its child sections
95
+ enter_change_bar_section node
93
96
  result = super
97
+ exit_change_bar_section node
94
98
  # Start position was captured at heading-ink time (after any page advance)
95
99
  if @change_bar_attr && !scratch? && (start_pos = take_change_bar_start node)
96
100
  ink_change_bar start_pos, { page: page_number, cursor: cursor }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asciidoctor-rhrev
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 白一百 baiyibai