asciidoctor-rhrev 1.9.0 → 1.9.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: e018143599f73eace12e5f22c99a54119721a6358e61abb67d5040b81118712b
4
- data.tar.gz: 194a1c032bd7602dfffe37c6bf87e069ff64d19e172244e3f05fab5effdf7947
3
+ metadata.gz: 1da65b61e67581cc903950852a590dbd89c965414c2abaa40059bb8f445e4c6a
4
+ data.tar.gz: 2d6fa89231f2724df9152df5346318a05dfdf1465eb64dfd9d29df114ab6e9fa
5
5
  SHA512:
6
- metadata.gz: f1f9463fa7dc56dbb4f0d521ff547806724927ffb4b4f87289a30262bf2f7aba2812b6c99eb5eb58927d30e346b80740591f16fe0458559e1e1c2341765b2c64
7
- data.tar.gz: 69433c330dca726113054335cff0ac2856882f6f18d07eaf31866ecec4f9543f6276a871f9c8409f942e1e2ee784a69b0ae06943c68b222c054c8c57d73677f9
6
+ metadata.gz: 3eb4539c96fbdfb34d70335963d9312121ef2a5c93af4f049731822d0ee236b9c8d2feaf296c225e5e50b12486a599da539ff98e6c79948ff0e573991535cf41
7
+ data.tar.gz: 9fe21ece1dd48a8d1c4acc605ad1b4fb9872296ff56a2438f9ccf9689d218c392899ea4c243a879957754b9bc537fd807a8b5e279b967f2d25b77c6aca6372ab
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,15 @@
1
1
  = Changelog
2
2
 
3
+ == 1.9.2 (2026-10-27)
4
+
5
+ * Change bar table labels stand upright, one character per line, read from top to bottom, with the labels of all columns sharing one bottom line; labels no longer turn 90 degrees. `ink_change_bar_table_label` draws each label (gem)
6
+ * Fix a change bar or change bar table drawn past the page edge when the side margin is narrower than the bar's offset and width. `change_bar_inside_page` moves the bar or table inward until it meets the page edge and logs one warning per document naming the space the change bars need. Zero-margin checks in `tests/regression/third-level.rb` cover a right-side table, a left-side table, and the bar (gem)
7
+ * Fix `include file not found` errors for `partial$` includes on every page after the first in Antora builds. `antora-rhrev-html.js` reused one extension registry for its page scan, and each load kept only the extensions registered in a group block, dropping the no-op include processor after the first page; the processor now registers inside the registry's group block. New regression file `tests/regression/js-include-pages.js` (npm)
8
+
9
+ == 1.9.1 (2026-10-27)
10
+
11
+ * Fix an rhrev attribute with an empty change text, such as `[rhrev1-3=""]`, drawing a change bar and adding a stray `*` bullet to its enclosing row. The extension now skips an empty mark, `-all`, or `-cover` attribute as if absent: no change bar, no entry. `ThirdLevel.drop_empty_marks` runs before the mixed-release check in the PDF and HTML backends, `dropEmptyMarks` in both Antora extension files, and the Antora cell-text lift adds no `rhrev-changed` span for an empty mark. New regression files `tests/regression/empty-change-text.rb` and `tests/regression/js-empty-change-text.js` (gem and npm)
12
+
3
13
  == 1.9.0 (2026-10-27)
4
14
 
5
15
  * Third-level revisions such as `1.3.2`. The `rhrev-third-level` attribute selects `collapse` or `expand`, and `rhrev-third-level-kind` selects `draft`, the default, or `amendment`. With either mode, every mark of the current `x.y` release up to the current third level draws a change bar. `collapse` groups the revision history table by `x.y`, merging change texts and `all` and `cover` entries, with the group header reading `x-y-prevrev` and falling back to the lowest third-level `prevrev`. `expand` keeps one group per revision. `draft` orders `x.y` after its drafts, and a bare `x.y` mark beside its own drafts logs a warning and is ignored everywhere, `all` and `cover` entries included; `amendment` orders `x.y` before its amendments. New `third_level.rb` and `antora-extension/third-level.js`; the Antora extensions parse every page first so a release ignored on one page is ignored on all. Unset, output is unchanged (gem and npm)
@@ -47,6 +47,7 @@ module Asciidoctor
47
47
  @change_bar_starts = {}
48
48
  @change_bar_section_stack = []
49
49
  @change_bar_grid_labeled_pages = {}
50
+ @change_bar_margin_warned = false
50
51
  end
51
52
 
52
53
  # Resolved lazily on first ink: the theme (and @media/@folio_placement)
@@ -185,7 +186,32 @@ module Asciidoctor
185
186
  # number (honoring pdf-folio-placement inversion), matching prepress
186
187
  # physical folio placement.
187
188
  def change_bar_x pgnum, settings
188
- (change_bar_on_right? pgnum, settings) ? bounds.right + settings[:offset] : bounds.left - settings[:offset] - settings[:width]
189
+ on_right = change_bar_on_right? pgnum, settings
190
+ x = on_right ? bounds.right + settings[:offset] : bounds.left - settings[:offset] - settings[:width]
191
+ change_bar_inside_page x, settings[:width], 0, on_right, settings
192
+ end
193
+
194
+ # Keeps a bar or table of width at x inside the page. When its outer
195
+ # edge, plus inset for a border stroke, crosses the page edge, it
196
+ # moves inward until that edge meets the page edge, and the first
197
+ # move in the document warns with the space it needs between the
198
+ # text and the page edge.
199
+ def change_bar_inside_page x, width, inset, on_right, settings
200
+ if on_right
201
+ edge = page.dimensions[2] - bounds.absolute_left
202
+ return x if x + width + inset <= edge
203
+ moved = edge - width - inset
204
+ else
205
+ edge = -bounds.absolute_left
206
+ return x if x - inset >= edge
207
+ moved = edge + inset
208
+ end
209
+ unless @change_bar_margin_warned
210
+ @change_bar_margin_warned = true
211
+ needed = settings[:offset] + width + inset
212
+ logger.warn %(rhrev change bars need #{needed.round 2}pt between the text and the page edge; drawing them inside the page edge instead)
213
+ end
214
+ moved
189
215
  end
190
216
 
191
217
  def change_bar_on_right? pgnum, settings
@@ -234,6 +260,7 @@ module Asciidoctor
234
260
  column_of = change_bar_table_columns @change_bar_lane_index.size, settings[:table_max_columns]
235
261
  count = column_of.last + 1
236
262
  left = on_right ? bounds.right + settings[:offset] : bounds.left - settings[:offset] - count * width
263
+ left = change_bar_inside_page left, count * width, settings[:table_border_width] / 2.0, on_right, settings
237
264
  column_x = ->(column) { on_right ? left + column * width : left + (count - 1 - column) * width }
238
265
  lanes.map {|lane| column_of[lane] }.uniq.each do |column|
239
266
  ink_change_bar_fill (column_x.call column), top, bottom, width, settings[:color]
@@ -256,9 +283,10 @@ module Asciidoctor
256
283
  # Labels each column at the top of the page body with the
257
284
  # third-level number of the newest lane it holds, 0 for the x.y
258
285
  # release itself. The labels sit above every box on the page,
259
- # whichever box inks first. When any label is wider than a column,
260
- # every label reads upward, turned 90 degrees and centered on its
261
- # column. A label font size of 0 omits the labels.
286
+ # whichever box inks first. Each label stands one character per
287
+ # line, its last character resting on the label baseline, so the
288
+ # labels of all columns share one bottom line whatever their
289
+ # length. A label font size of 0 omits the labels.
262
290
  def ink_change_bar_table_labels pgnum, column_of, column_x, settings
263
291
  @change_bar_grid_labeled_pages[pgnum] = true
264
292
  return unless (size = settings[:table_label_font_size]) > 0
@@ -270,24 +298,22 @@ module Asciidoctor
270
298
  font (settings[:table_label_font_family] || font.family), style: settings[:table_label_font_style] do
271
299
  font_size size do
272
300
  width = settings[:table_column_width]
273
- labels = newest.map {|column, lane| [column, (revisions[lane] || 0).to_s] }
274
- if labels.any? {|_, label| (width_of label) > width }
275
- # Turned text extends from its baseline toward lower x, so
276
- # the baseline sits half a digit height past the center.
277
- shift = (font.ascender - font.descender) * 0.35
278
- labels.each do |column, label|
279
- draw_text label, at: [(column_x.call column) + width / 2.0 + shift, bounds.top + 2], rotate: 90
280
- end
281
- else
282
- labels.each do |column, label|
283
- draw_text label, at: [(column_x.call column) + (width - (width_of label)) / 2.0, bounds.top + 2], rotate: 0
284
- end
301
+ newest.each do |column, lane|
302
+ ink_change_bar_table_label (revisions[lane] || 0).to_s, (column_x.call column), width
285
303
  end
286
304
  end
287
305
  end
288
306
  end
289
307
  end
290
308
 
309
+ # Stacks the characters of label upward from the label baseline,
310
+ # each centered on the column at left.
311
+ def ink_change_bar_table_label label, left, width
312
+ label.chars.reverse.each_with_index do |char, line|
313
+ draw_text char, at: [left + (width - (width_of char)) / 2.0, bounds.top + 2 + line * font.ascender]
314
+ end
315
+ end
316
+
291
317
  # Paints the bar page by page; from/to are { page:, cursor: }, and
292
318
  # from[:lanes] lists the table columns to fill, the first when absent.
293
319
  # Called immediately after the block is rendered, so all spanned pages exist.
@@ -164,6 +164,7 @@ module Asciidoctor
164
164
  # Lifting cell text marks first lets the mixed-release check see
165
165
  # them; prescan_document lifts again, which finds nothing left.
166
166
  ::Asciidoctor::Rhrev::CellTextMarks.lift node, @revision_prefix
167
+ ::Asciidoctor::Rhrev::ThirdLevel.drop_empty_marks node, @revision_prefix
167
168
  ::Asciidoctor::Rhrev::ThirdLevel.drop_mixed_release_marks node, @revision_prefix
168
169
  init_change_bars node
169
170
 
@@ -42,6 +42,7 @@ module Asciidoctor
42
42
  prefix = document.attr 'revhistoryprefix', 'rhrev'
43
43
 
44
44
  ::Asciidoctor::Rhrev::CellTextMarks.lift document, prefix
45
+ ::Asciidoctor::Rhrev::ThirdLevel.drop_empty_marks document, prefix
45
46
  ::Asciidoctor::Rhrev::ThirdLevel.drop_mixed_release_marks document, prefix
46
47
 
47
48
  document.find_by(context: :table).each do |table|
@@ -96,6 +96,18 @@ module Asciidoctor
96
96
  revision_of key.to_s.sub(/-(?:all|cover)\z/, ''), prefix
97
97
  end
98
98
 
99
+ # Removes every mark, -all, and -cover entry with an empty value, so
100
+ # an empty mark draws no change bar and adds no entry anywhere. Runs
101
+ # once per document, after CellTextMarks.lift and before
102
+ # drop_mixed_release_marks.
103
+ def self.drop_empty_marks doc, prefix
104
+ return if doc.instance_variable_get :@rhrev_empty_marks_dropped
105
+ doc.instance_variable_set :@rhrev_empty_marks_dropped, true
106
+ each_marked_attributes(doc) do |attributes|
107
+ attributes.delete_if {|key, value| (marked_revision_of key, prefix) && value.to_s.strip.empty? }
108
+ end
109
+ end
110
+
99
111
  # In a draft-kind document, removes every mark, -all, and -cover
100
112
  # entry of an x-y release that the document also marks drafts of,
101
113
  # warning once per release, so no backend shows a release beside its
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.9.0
4
+ version: 1.9.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 白一百 baiyibai