asciidoctor-rhrev 1.2.0 → 1.2.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: ba4b787b526a584c23e8d5c890cfc0459711552efb13b11e483b2847706f018e
4
- data.tar.gz: 5e740bd4af7144bcc3ad461ddadfc402883354395f372c1336439e87d498547f
3
+ metadata.gz: 4d83e91d276df02dd54e4b4af8c2ca5524ec503c36603e0e5f268309e5f0d529
4
+ data.tar.gz: 7780816da60b8799b7c4e9427fa7436c086862b0b8dde350e5a681f76f4ee017
5
5
  SHA512:
6
- metadata.gz: 9ad667cf9c86e5462ca177eae98fddad13335354c26083fb15cfe5639630b7044e0e623b7e5b1f5f069fe4689403e6c382246db47c7127aafe89d2f1fa204853
7
- data.tar.gz: fca906ea2b5256d3d141828ee39ef3298fb9420dbea437f424e6cac633035e8dec6463ca2bdd30c76d86c73e08125bb7620c94fdff4015970cc9b65fa837f764
6
+ metadata.gz: a232c651f5391d90456fe32ada20a1f072044b74bc7998339197662015091fc2781ea053599911abb74fc56384ed63a86c77016562198ae25751282a5c9abfb4
7
+ data.tar.gz: 20cdc734fb0840b3846ff3f01add4d1442c957ce84add7057920b14cb1e456816fd5a20ad870fc77228fe63d3276233455a70dd3f7f1d15a6649be5a65ddff30
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,16 @@
1
1
  = Changelog
2
2
 
3
+ == 1.2.2 (2026-07-15)
4
+
5
+ * Fix the initial-release table (revnumber `1.0`/`1`) dropping the `rhrev-table-caption` and the custom first row (`rhrev-customization-first-row`, `-left`, `-right`) in the PDF backend; both now render the same way as in the regular revision-history table
6
+ * Fix the initial-release table dropping the custom first row in the HTML backend and the Antora extension (the caption already rendered there)
7
+ * Fix the HTML backend dropping the right cell (`rhrev-customization-first-row-right`) whenever the left cell was also set, in both the regular and initial-release tables
8
+ * Note: the npm package skips 1.2.1, which was a PDF-only fix; gem and npm versions are aligned again at 1.2.2
9
+
10
+ == 1.2.1 (2026-07-07)
11
+
12
+ * 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
13
+
3
14
  == 1.2.0 (2026-07-07)
4
15
 
5
16
  * 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 }
@@ -250,6 +250,7 @@ module Asciidoctor
250
250
  markup_lines = []
251
251
  markup_lines << "[cols='#{formatted_widths}']"
252
252
  markup_lines << "|==="
253
+ add_custom_first_row_to_markup markup_lines, doc
253
254
  table_data.each do |row|
254
255
  markup_lines << "|#{row[0]} |#{row[1]}"
255
256
  end
@@ -263,7 +264,11 @@ module Asciidoctor
263
264
  if (stripes = doc.attr 'rhrev-table-stripes')
264
265
  table.set_attr 'stripes', stripes
265
266
  end
266
-
267
+
268
+ if !(doc.attr? 'rhrev-disable-caption') && (caption = doc.attr 'rhrev-table-caption')
269
+ table.title = caption
270
+ end
271
+
267
272
  convert_table table
268
273
  end
269
274
 
@@ -134,6 +134,23 @@ module Asciidoctor
134
134
  column_widths.each { |w| html << %(<col style="width: #{w}%;">)}
135
135
  html << '</colgroup>'
136
136
  html << '<tbody>'
137
+
138
+ # Custom first row
139
+ if (first_row = doc.attr('rhrev-customization-first-row'))
140
+ html << '<tr class="rhrev-custom-first-row">'
141
+ html << %(<td colspan="2">#{first_row}</td>)
142
+ html << '</tr>'
143
+ else
144
+ first_row_left = doc.attr('rhrev-customization-first-row-left')
145
+ first_row_right = doc.attr('rhrev-customization-first-row-right')
146
+ if first_row_left || first_row_right
147
+ html << '<tr class="rhrev-custom-first-row">'
148
+ html << %(<td>#{first_row_left || '&nbsp;'}</td>)
149
+ html << %(<td>#{first_row_right || '&nbsp;'}</td>)
150
+ html << '</tr>'
151
+ end
152
+ end
153
+
137
154
  html << '<tr class="rhrev-header">'
138
155
  html << %(<th class="tableblock halign-left valign-top">#{section_label}</th>)
139
156
  html << %(<th class="tableblock halign-left valign-top"><strong>#{major_changes_text} #{version_label} #{revnumber}</strong></th>)
@@ -228,12 +245,15 @@ module Asciidoctor
228
245
  html << '<tr class="rhrev-custom-first-row">'
229
246
  html << %(<td colspan="2">#{first_row}</td>)
230
247
  html << '</tr>'
231
- elsif (first_row_left = doc.attr('rhrev-customization-first-row-left')) ||
232
- (first_row_right = doc.attr('rhrev-customization-first-row-right'))
233
- html << '<tr class="rhrev-custom-first-row">'
234
- html << %(<td>#{first_row_left || '&nbsp;'}</td>)
235
- html << %(<td>#{first_row_right || '&nbsp;'}</td>)
236
- html << '</tr>'
248
+ else
249
+ first_row_left = doc.attr('rhrev-customization-first-row-left')
250
+ first_row_right = doc.attr('rhrev-customization-first-row-right')
251
+ if first_row_left || first_row_right
252
+ html << '<tr class="rhrev-custom-first-row">'
253
+ html << %(<td>#{first_row_left || '&nbsp;'}</td>)
254
+ html << %(<td>#{first_row_right || '&nbsp;'}</td>)
255
+ html << '</tr>'
256
+ end
237
257
  end
238
258
 
239
259
  section_label = doc.attr 'rhrev-localization-location', 'Section'
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.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 白一百 baiyibai