asciidoctor-rhrev 1.7.0 → 1.7.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: 7ff948e637bb99f9d64376d94ad293310988680a558ef3796aa797911210ad48
4
- data.tar.gz: f47c7b2ecf6aa55d7e396b44221e8d7af6445c9c6085a71182e8b0a457e09226
3
+ metadata.gz: e9f44d95401427d9f6c7fd320ebc68b8a998956bd4092ea6225d7f46c89d574c
4
+ data.tar.gz: 3d1fe74b24dfda792f2e35549bf73cb7823ee227b3a67cf16af38f003c57459e
5
5
  SHA512:
6
- metadata.gz: a908055a506c6d32629d381a800c2c8911e649e0d4dfcd51ea2b5bb64a7d70e6bd4bb45229541947b9e840df95a9c3335d03179634cfe8efd99d51bedc8a5cb5
7
- data.tar.gz: 8f5442540754978416479cf2b90f01d207993659b9e243277cdc1d645475dec294379691b62b88d1b7ad55ef3748f4af318486ea3bc7fc3ee6d6e08e2cf3d74b
6
+ metadata.gz: 2a839f2d707b970ff7eeb8e284743510500f04cbcef2b28fb803d4ad0ae747cf74fce15608f078493cd35b759c0a7e9064a5f603fa3c33a7c306b9fff0fd930f
7
+ data.tar.gz: 563a298805ee6f14ff4209d0174ab6c248fb5e360931b8aead2b91fe6a8abc102c314a511b8635fe0e8f7c4766f77154fce8b0ed5493c298a8d31af9ecbccad3
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,10 @@
1
1
  = Changelog
2
2
 
3
+ == 1.7.1 (2026-09-02)
4
+
5
+ * Fix two revision-history entries sharing the same start page sorting in the wrong relative order whenever one of them has body content that spans a page break (PDF backend). `Converter#convert_section` correctly reads a section's own starting page via `pdf-page-start`, set by asciidoctor-pdf's own `convert_section` right before the heading itself is inked, but paired it with a `:dest][:y]` value read from `cursor` after `result = super` returns, once the section's whole body (nested content, a large table, anything that can span several physical pages of its own) had already rendered. For a page-spanning section that cursor belongs to whatever page the body finished on, not the section's own start page `pdf-page-start` names, so the two stopped describing the same physical location at all; two entries sharing that start page are ordered by this `y` value alone (`renderer.rb`'s own `entries.sort_by`), and a wrong one can reverse their true top-to-bottom order. Reported directly, with real captured values from a real document, confirming exactly this: a page-spanning section's own `y` secretly belonging to the next physical page, sorting it ahead of another entry that genuinely was higher on their shared page. `ChangeBars#record_section_heading_position`, called unconditionally, not gated on change bars being enabled at all, from `ink_general_heading`/`ink_chapter_title`/`ink_part_title`, the same moment upstream itself captures `pdf-page-start`, right before the heading is actually inked. `Converter#convert_section` reads it back instead of a live post-super cursor, so `page_num` and `y` always describe the section's own start consistently. New regression file, `tests/regression/section-dest-y-page-mismatch.rb`, forces the page-spanning body with an explicit `<<<` page break rather than tuning paragraph-repeat counts against exact font metrics, deterministic regardless of theme or font; confirmed to fail (reversed order) without the fix and pass with it
6
+ * Note: gem-only; the Antora extension (HTML output, no PDF page/cursor concept) is unaffected, npm still bumps concurrently per the standing 1.5.1 policy
7
+
3
8
  == 1.7.0 (2026-09-02)
4
9
 
5
10
  * Replace 1.6.0's per-item list change bars with a different design, after real user feedback that the syntax it needed was too heavy: marking one item required a `+` continuation, an attribute line, and a two-line empty open block, four lines to mark a single bullet, far more than every other rhrev-markable construct's own single attribute line. 1.6.0's mechanism (`Converter#propagate_list_item_content_marks`, the attached-continuation-block workaround, `list_item` added to the roll-up contexts) is fully removed, not just superseded
@@ -62,6 +62,29 @@ module Asciidoctor
62
62
  @change_bar_starts&.delete node
63
63
  end
64
64
 
65
+ # A section's own cursor position at heading-ink time, before its
66
+ # body (potentially spanning several pages) renders. Unconditional,
67
+ # not gated on change bars being enabled at all: Converter#
68
+ # convert_section's own revision-history dest needs this, pairing
69
+ # it with pdf-page-start (also captured at this same moment,
70
+ # upstream's own convert_section, right before the heading ink
71
+ # call this method wraps) so both fields describe the section's
72
+ # own start consistently. A page-spanning section's cursor read
73
+ # after the whole body renders belongs to wherever that body
74
+ # finished, not the section's own start page; two entries sharing
75
+ # the same start page then sort by a y value that was never on
76
+ # that page at all, reversing their true top-to-bottom order,
77
+ # confirmed directly against a real document.
78
+ def record_section_heading_position node
79
+ return unless node.context == :section
80
+ @section_heading_positions ||= {}
81
+ @section_heading_positions[node] = cursor
82
+ end
83
+
84
+ def take_section_heading_position node
85
+ @section_heading_positions&.delete node
86
+ end
87
+
65
88
  # A section's bar covers only its own directly-owned content, not any
66
89
  # nested child sections/chapters: as soon as a child section begins
67
90
  # rendering, close out the bar of every still-open ancestor section
@@ -177,11 +200,13 @@ module Asciidoctor
177
200
  # have settled the page, so this is the first accurate start position.
178
201
  def ink_general_heading node, title, opts = {}
179
202
  record_change_bar_start node if @change_bar_attr && !scratch? && (change_bar? node)
203
+ record_section_heading_position node unless scratch?
180
204
  super
181
205
  end
182
206
 
183
207
  def ink_chapter_title node, title, opts = {}
184
208
  record_change_bar_start node if @change_bar_attr && !scratch? && (change_bar? node)
209
+ record_section_heading_position node unless scratch?
185
210
  super
186
211
  end
187
212
 
@@ -189,6 +214,7 @@ module Asciidoctor
189
214
  # so it must be overridden separately
190
215
  def ink_part_title node, title, opts = {}
191
216
  record_change_bar_start node if @change_bar_attr && !scratch? && (change_bar? node)
217
+ record_section_heading_position node unless scratch?
192
218
  super
193
219
  end
194
220
  end
@@ -227,6 +227,27 @@ module Asciidoctor
227
227
  # page break. A pre-super page_number would be the page before that
228
228
  # break, one page too low for any chapter-starting section.
229
229
  page_num = ((node.attr 'pdf-page-start') || page_number).to_i
230
+
231
+ # y must describe the same physical location page_num does: the
232
+ # section's own start, not wherever cursor happens to sit once
233
+ # this whole call returns. A section's body can span several
234
+ # pages of its own (nested content, a large table, and so on);
235
+ # a post-super cursor read then belongs to whatever page that
236
+ # body finished on, not page_num's page, and the two stop
237
+ # describing the same point at all. take_section_heading_
238
+ # position (change_bars.rb) captured cursor at the same moment
239
+ # upstream captured pdf-page-start, right before the heading
240
+ # itself was inked, so pairing the two here always describes
241
+ # the section's own start consistently. Reported directly
242
+ # against a real document: two entries sharing the same
243
+ # page_sortable sorted in the wrong relative order, one of
244
+ # them a page-spanning section whose old post-super y actually
245
+ # belonged to the page after the one it was paired with.
246
+ # Falls back to the old post-super cursor only for a section
247
+ # with no heading ink call at all (a hidden title), no worse
248
+ # than before for that one remaining case.
249
+ y_pos = take_section_heading_position(node) || cursor
250
+
230
251
  @anchor_catalog ||= {}
231
252
  @anchor_catalog[node.id] ||= {
232
253
  title: node.title,
@@ -235,10 +256,10 @@ module Asciidoctor
235
256
  context: node.context,
236
257
  level: node.level
237
258
  }
238
- @anchor_catalog[node.id][:dest] = { page: (rhrev_display_page page_num), physical_page: page_num, y: cursor }
259
+ @anchor_catalog[node.id][:dest] = { page: (rhrev_display_page page_num), physical_page: page_num, y: y_pos }
239
260
 
240
261
  # Link destination to page for revision history
241
- revision_history.link_dest_to_page node.id, page_num, (@rhrev_body_start_page || 1), y: cursor
262
+ revision_history.link_dest_to_page node.id, page_num, (@rhrev_body_start_page || 1), y: y_pos
242
263
  end
243
264
 
244
265
  # Start position was captured at heading-ink time (after any page advance)
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.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - 白一百 baiyibai