asciidoctor-rhrev 1.8.0 → 1.8.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 +4 -4
- data/CHANGELOG.adoc +10 -0
- data/lib/asciidoctor/rhrev/converter.rb +16 -53
- data/lib/asciidoctor/rhrev/renderer.rb +2 -2
- data/lib/asciidoctor/rhrev/table_cell_change_bar_patch.rb +54 -26
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 155f025dbf45d15c912cbb3f624bc9214344472bd3d33e21c8cfb8dcca21f54a
|
|
4
|
+
data.tar.gz: b6ceffec703149d7b45f2c3007ff32099421532cf9e73f9cff763200706f6b00
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: eb676e02167dad226f2ef494bf8de843df79497d8f6fd419d44d815c727e635ea6d62ca9767283540630a515ae27c201695d67875b57d6684158cb1dc15f26e2
|
|
7
|
+
data.tar.gz: 4369e143e5614067d6f0f28039788e5004a5f772bc5383beacfd56c6f20c3dd7970808515bbcf9b459337d4d7b726e79f3b1d20bbdaa46a689cc26bb639fa6f4
|
data/CHANGELOG.adoc
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
= Changelog
|
|
2
2
|
|
|
3
|
+
== 1.8.2 (2026-10-06)
|
|
4
|
+
|
|
5
|
+
* Change the initial-release table's default text from `Initial Release` to `Initial release` and render it bold (PDF backend), matching the bold `Page` cell beside it; `rhrev-customization-initial-release-text` still overrides the text and is rendered bold too
|
|
6
|
+
* Note: gem-only; the Antora extension is unaffected, npm still bumps concurrently per the standing 1.5.1 policy
|
|
7
|
+
|
|
8
|
+
== 1.8.1 (2026-09-08)
|
|
9
|
+
|
|
10
|
+
* Fix a table-cell change bar spanning every row of an unmarked rowspanned cell that sits in the same row as the marked cell (PDF backend). `table_cell_change_bar_patch.rb` matched drawn cells to the marked row by row index, so every cell in that row inked a bar with its own height, the spanning cell included. The marked cell is now flagged as itself while Prawn builds the table: a hook on `Prawn::Table#initialize` reads the node `Converter#convert_table` stashes in `@rhrev_table_cell_bar_node`, walks Asciidoctor's rows and asciidoctor-pdf's cell data in step, source order both, and sets `rhrev_marked` on exactly the marked cells, through a new writer on `Prawn::Table::Cell` for a plain cell's option hash or directly on the prebuilt `Prawn::Table::Cell::AsciiDoc` for an `a|` cell; `draw_background` inks only for a flagged cell, with that cell's own height. A marked spanning cell keeps its full-height bar. `Converter#marked_table_cell_bar_rows` and the per-table bar-row stash on `@pagerhref_tables` are removed; `ink_pagerhref_tables` points the hook at its stashed node instead. Reported directly against a real document. Three spy-based checks in `tests/regression/table-cell-change-bar.rb` replace the removed method's unit checks: one marked cell among many rows, an unmarked three-row cell beside the marked cell, and a marked three-row cell; the second fails (two calls) without the fix and passes with it
|
|
11
|
+
* Note: gem-only; the Antora extension is unaffected, npm still bumps concurrently per the standing 1.5.1 policy
|
|
12
|
+
|
|
3
13
|
== 1.8.0 (2026-09-08)
|
|
4
14
|
|
|
5
15
|
* Table-cell marks no longer require the AsciiDoc-style cell prefix `a|`: an rhrev attribute list alone on the first line of any cell's content marks the cell, for every style prefix and none, and for cells in a header row, which no earlier release could mark at all. `Asciidoctor::Rhrev::CellTextMarks` reads the attribute list off the cell's raw text, sets the attributes on the cell, and strips the line, before the existing `a|` propagation runs; the PDF prescan, the HTML treeprocessor, and both Antora extension files use it. In Antora output the lift wraps a marked plain or header cell's text in an `rhrev-changed` role span so the existing table post-processor tags the cell's own `<td>`/`<th>`; a literal cell renders verbatim and stays untagged there, its mark still rolls up. Foot rows now join every table-cell walk. New fixture `tests/features/test-change-bars-table-header-cells.adoc` and regression files `tests/regression/table-header-cell-marks.rb`, `html-table-header-cell-marks.rb`, and `js-table-header-cell-marks.js`
|
|
@@ -33,7 +33,7 @@ module Asciidoctor
|
|
|
33
33
|
@catalog = nil
|
|
34
34
|
@manual_mode = false
|
|
35
35
|
@rhrev_body_start_page = nil
|
|
36
|
-
@
|
|
36
|
+
@rhrev_table_cell_bar_node = nil
|
|
37
37
|
end
|
|
38
38
|
|
|
39
39
|
def revision_history
|
|
@@ -269,28 +269,6 @@ module Asciidoctor
|
|
|
269
269
|
result
|
|
270
270
|
end
|
|
271
271
|
|
|
272
|
-
# The 0-indexed row positions (head rows then body rows, one combined
|
|
273
|
-
# sequence, matching Prawn::Table::Cell#row) that contain at least
|
|
274
|
-
# one cell carrying the current revision's change-bar attribute, or
|
|
275
|
-
# nil if none do. Row index only, not (row, column): the bar only
|
|
276
|
-
# cares which row, see convert_table for the full reasoning
|
|
277
|
-
# (colspan makes a reliable column index unsafe to compute, source_
|
|
278
|
-
# location, tried first, turned out to always be nil under normal
|
|
279
|
-
# CLI usage and matched every cell instead of just the marked one).
|
|
280
|
-
# Extracted as its own method specifically so it can be tested
|
|
281
|
-
# directly: that bug was invisible to a real-render/pdftotext check,
|
|
282
|
-
# the table's own revision-history entry was already correct either
|
|
283
|
-
# way, only the bar geometry was wrong, and bars are graphical.
|
|
284
|
-
def marked_table_cell_bar_rows node
|
|
285
|
-
marked_rows = []
|
|
286
|
-
(node.rows[:head] + node.rows[:body] + node.rows[:foot]).each_with_index do |row, row_idx|
|
|
287
|
-
marked_rows << row_idx if row.any? do |cell|
|
|
288
|
-
cell.respond_to?(:attributes) && cell.attributes && (cell.attributes.key? @change_bar_attr)
|
|
289
|
-
end
|
|
290
|
-
end
|
|
291
|
-
marked_rows.empty? ? nil : marked_rows
|
|
292
|
-
end
|
|
293
|
-
|
|
294
272
|
def convert_table node
|
|
295
273
|
has_id = node.id && !node.id.empty? rescue false
|
|
296
274
|
has_rhrev = false
|
|
@@ -303,19 +281,14 @@ module Asciidoctor
|
|
|
303
281
|
has_pagerhref = @manual_mode && !@rendering_deferred_table && table_contains_pagerhref?(node)
|
|
304
282
|
|
|
305
283
|
# A cell carrying the current revision's attribute gets its own
|
|
306
|
-
# margin bar at draw time
|
|
307
|
-
#
|
|
308
|
-
# table
|
|
309
|
-
#
|
|
310
|
-
#
|
|
311
|
-
#
|
|
312
|
-
#
|
|
313
|
-
|
|
314
|
-
# worse, another table's stale value) by the time that later pass
|
|
315
|
-
# runs, since every ordinary convert_table call clears it in its
|
|
316
|
-
# own ensure block below, long before ink_pagerhref_tables ever
|
|
317
|
-
# starts.
|
|
318
|
-
@rhrev_table_cell_bar_rows = marked_table_cell_bar_rows(node) if @change_bar_attr && !scratch?
|
|
284
|
+
# margin bar at draw time, independent of whether the table itself
|
|
285
|
+
# is marked: table_cell_change_bar_patch.rb reads this node back
|
|
286
|
+
# while Prawn builds the table and flags exactly the marked cells.
|
|
287
|
+
# For a manual-mode pagerhref table the real, deferred render
|
|
288
|
+
# happens in ink_pagerhref_tables, which sets this ivar again from
|
|
289
|
+
# its own stashed node right before that render: the ensure block
|
|
290
|
+
# below has long since cleared it by then.
|
|
291
|
+
@rhrev_table_cell_bar_node = node if @change_bar_attr && !scratch?
|
|
319
292
|
|
|
320
293
|
if !has_id && !has_rhrev && !has_pagerhref
|
|
321
294
|
return super
|
|
@@ -342,7 +315,7 @@ module Asciidoctor
|
|
|
342
315
|
result
|
|
343
316
|
end
|
|
344
317
|
ensure
|
|
345
|
-
@
|
|
318
|
+
@rhrev_table_cell_bar_node = nil
|
|
346
319
|
end
|
|
347
320
|
|
|
348
321
|
def convert_image node
|
|
@@ -1033,15 +1006,9 @@ module Asciidoctor
|
|
|
1033
1006
|
move_cursor_to extent.to.cursor
|
|
1034
1007
|
|
|
1035
1008
|
# Store for later re-rendering with actual page numbers.
|
|
1036
|
-
# bar_rows is @rhrev_table_cell_bar_rows as convert_table computed
|
|
1037
|
-
# it for THIS node, a few lines before this method was called;
|
|
1038
|
-
# stashed here since the ivar itself will not survive to
|
|
1039
|
-
# ink_pagerhref_tables's own later pass, see that ivar's own
|
|
1040
|
-
# comment in convert_table for why.
|
|
1041
1009
|
@pagerhref_tables << {
|
|
1042
1010
|
node: node,
|
|
1043
|
-
extent: extent
|
|
1044
|
-
bar_rows: @rhrev_table_cell_bar_rows
|
|
1011
|
+
extent: extent
|
|
1045
1012
|
}
|
|
1046
1013
|
end
|
|
1047
1014
|
|
|
@@ -1063,20 +1030,16 @@ module Asciidoctor
|
|
|
1063
1030
|
go_to_page extent.from.page
|
|
1064
1031
|
move_cursor_to extent.from.cursor
|
|
1065
1032
|
|
|
1066
|
-
#
|
|
1067
|
-
#
|
|
1068
|
-
#
|
|
1069
|
-
|
|
1070
|
-
# table's stale value by this point, since every ordinary
|
|
1071
|
-
# convert_table call already cleared it right after computing
|
|
1072
|
-
# it, long before this loop ever runs.
|
|
1073
|
-
@rhrev_table_cell_bar_rows = table_info[:bar_rows]
|
|
1033
|
+
# Point table_cell_change_bar_patch.rb at THIS table for the real
|
|
1034
|
+
# render below: convert_table's own ensure block cleared the ivar
|
|
1035
|
+
# long before this loop runs.
|
|
1036
|
+
@rhrev_table_cell_bar_node = node if @change_bar_attr && !scratch?
|
|
1074
1037
|
|
|
1075
1038
|
# Re-render the table with flag set to prevent recursion
|
|
1076
1039
|
@rendering_deferred_table = true
|
|
1077
1040
|
super_convert_table node
|
|
1078
1041
|
@rendering_deferred_table = false
|
|
1079
|
-
@
|
|
1042
|
+
@rhrev_table_cell_bar_node = nil
|
|
1080
1043
|
end
|
|
1081
1044
|
end
|
|
1082
1045
|
|
|
@@ -235,8 +235,8 @@ module Asciidoctor
|
|
|
235
235
|
table_data = []
|
|
236
236
|
|
|
237
237
|
page_label = doc.attr 'rhrev-localization-page', 'Page'
|
|
238
|
-
initial_text = doc.attr 'rhrev-customization-initial-release-text', 'Initial
|
|
239
|
-
table_data << ["*#{page_label}*", initial_text]
|
|
238
|
+
initial_text = doc.attr 'rhrev-customization-initial-release-text', 'Initial release'
|
|
239
|
+
table_data << ["*#{page_label}*", "*#{initial_text}*"]
|
|
240
240
|
|
|
241
241
|
formatted_widths = column_widths.map { |w| w.to_i.to_s }.join(',')
|
|
242
242
|
markup_lines = []
|
|
@@ -1,36 +1,34 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
# Inks a change bar in the page margin, at the same cursor height as the
|
|
4
|
-
#
|
|
4
|
+
# cell, for a table cell carrying the current revision's rhrev attribute.
|
|
5
5
|
# Change bars always live in the page margin, never inside the cell itself,
|
|
6
6
|
# humans scan the margin to find a change, not the table body. This has to
|
|
7
7
|
# run at cell draw time: Prawn has by then resolved the cell's real position
|
|
8
8
|
# and height, and a wrapped, multi-line cell's row height is not knowable
|
|
9
9
|
# before layout, only after it.
|
|
10
10
|
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
#
|
|
23
|
-
# the
|
|
24
|
-
#
|
|
11
|
+
# The marked cell is identified as itself, not by its row: Prawn::Table's
|
|
12
|
+
# constructor receives the cell data in the same order asciidoctor-pdf
|
|
13
|
+
# emits it, head rows then body rows then foot rows, each row's cells in
|
|
14
|
+
# source order, which is also the order Asciidoctor stores a row's cells.
|
|
15
|
+
# The hook on that constructor reads the table node the converter stashed
|
|
16
|
+
# in @rhrev_table_cell_bar_node, walks both structures in step, and flags
|
|
17
|
+
# every cell whose Asciidoctor counterpart carries the attribute. A plain
|
|
18
|
+
# cell arrives as a hash of options and takes the flag through the writer
|
|
19
|
+
# added on Prawn::Table::Cell below, the same way asciidoctor-pdf threads
|
|
20
|
+
# its own source_location through (lib/asciidoctor/pdf/ext/prawn-table/
|
|
21
|
+
# cell.rb); an AsciiDoc-style cell arrives as an already-built
|
|
22
|
+
# Prawn::Table::Cell::AsciiDoc inside the hash, which Prawn returns as is,
|
|
23
|
+
# so the flag goes onto that object directly. Prawn's own span dummies are
|
|
24
|
+
# never flagged, so a cell spanning several rows or columns draws one bar.
|
|
25
25
|
#
|
|
26
|
-
# An earlier version matched
|
|
27
|
-
#
|
|
28
|
-
#
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
# Found only by testing a table where that could not go unnoticed (one
|
|
33
|
-
# marked cell among many unmarked ones).
|
|
26
|
+
# An earlier version matched by row index: every cell drawn in a marked
|
|
27
|
+
# row fired the hook with its own height, so an unmarked cell spanning
|
|
28
|
+
# several rows in the same row as the marked cell drew a bar over all the
|
|
29
|
+
# rows it spanned. Before that, matching on source_location was tried,
|
|
30
|
+
# which is nil for every cell unless the document was parsed with
|
|
31
|
+
# sourcemap: true, so it matched all of them.
|
|
34
32
|
#
|
|
35
33
|
# Hooks draw_background, not draw_borders: draw_borders is already
|
|
36
34
|
# overridden by asciidoctor-pdf itself (transparent border color support),
|
|
@@ -50,10 +48,10 @@ if defined? ::Prawn::Table
|
|
|
50
48
|
module PDF
|
|
51
49
|
module Rhrev
|
|
52
50
|
module TableCellChangeBarPatch
|
|
51
|
+
attr_accessor :rhrev_marked
|
|
52
|
+
|
|
53
53
|
def draw_background pt
|
|
54
|
-
if @
|
|
55
|
-
(rows = @pdf.instance_variable_get(:@rhrev_table_cell_bar_rows)) &&
|
|
56
|
-
(rows.include? row)
|
|
54
|
+
if @rhrev_marked && @pdf.respond_to?(:ink_change_bar)
|
|
57
55
|
x, y = pt
|
|
58
56
|
page = @pdf.page_number
|
|
59
57
|
@pdf.ink_change_bar({ page: page, cursor: y }, { page: page, cursor: y - height })
|
|
@@ -63,6 +61,36 @@ if defined? ::Prawn::Table
|
|
|
63
61
|
end
|
|
64
62
|
|
|
65
63
|
::Prawn::Table::Cell.prepend TableCellChangeBarPatch
|
|
64
|
+
|
|
65
|
+
# Flags the marked cells while the table is being built from
|
|
66
|
+
# asciidoctor-pdf's cell data, before any cell object exists for a
|
|
67
|
+
# plain cell. Prawn extends every document instance with its table
|
|
68
|
+
# interface at construction, so the constructor is the reliable
|
|
69
|
+
# hook; a module prepended on the converter never sees the `table`
|
|
70
|
+
# call.
|
|
71
|
+
module TableCellChangeBarFlagging
|
|
72
|
+
def initialize data, document, options = {}, &block
|
|
73
|
+
node = document.instance_variable_get :@rhrev_table_cell_bar_node
|
|
74
|
+
change_attr = document.instance_variable_get :@change_bar_attr
|
|
75
|
+
if node && change_attr && data.is_a?(::Array)
|
|
76
|
+
rows = node.rows
|
|
77
|
+
(rows[:head] + rows[:body] + rows[:foot]).each_with_index do |row, r|
|
|
78
|
+
row.each_with_index do |cell, c|
|
|
79
|
+
next unless cell.respond_to?(:attributes) && cell.attributes && (cell.attributes.key? change_attr)
|
|
80
|
+
next unless (cell_data = data[r] && data[r][c]).is_a?(::Hash)
|
|
81
|
+
if (content = cell_data[:content]).is_a? ::Prawn::Table::Cell
|
|
82
|
+
content.rhrev_marked = true
|
|
83
|
+
else
|
|
84
|
+
cell_data[:rhrev_marked] = true
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
super
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
::Prawn::Table.prepend TableCellChangeBarFlagging
|
|
66
94
|
end
|
|
67
95
|
end
|
|
68
96
|
end
|