asciidoctor-rhrev 1.2.2 → 1.3.0

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: 4d83e91d276df02dd54e4b4af8c2ca5524ec503c36603e0e5f268309e5f0d529
4
- data.tar.gz: 7780816da60b8799b7c4e9427fa7436c086862b0b8dde350e5a681f76f4ee017
3
+ metadata.gz: cdb14bf628d2c8dd088c5f7f9a37012305efc17fd2c6f6717a4e6a08d3e9ac18
4
+ data.tar.gz: b8bbabee8370433715fc06a11259fae8ac7eb80e7821965aa2b348fbcd185bcb
5
5
  SHA512:
6
- metadata.gz: a232c651f5391d90456fe32ada20a1f072044b74bc7998339197662015091fc2781ea053599911abb74fc56384ed63a86c77016562198ae25751282a5c9abfb4
7
- data.tar.gz: 20cdc734fb0840b3846ff3f01add4d1442c957ce84add7057920b14cb1e456816fd5a20ad870fc77228fe63d3276233455a70dd3f7f1d15a6649be5a65ddff30
6
+ metadata.gz: a253125687474c408d3d89545d2c66d35f944a5330cb7e99213672bafcdcf199083a4528379b801a035726e0badd9ebd321101ebb27a9b2e3f3bd02e4a2be314
7
+ data.tar.gz: 8f4e7888fdbf89ba4a70705b97eed4aa4a05bc5b19e0b5ab96bbd4b295db47757b4d73b724b84243c724098ab4578c844cc9ee3564df655d9831c3adb5021e48
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,15 @@
1
1
  = Changelog
2
2
 
3
+ == 1.3.0 (2026-07-16)
4
+
5
+ * Add HTML change bars: with `:rhrev-change-bars:` set, tracked blocks (section, floating title, example, listing, table, image) marked with the current revision get the `rhrev-changed` CSS class in the HTML backend and the Antora extension; `rhrev-change-bars-color`, `-width`, and `-offset` are emitted as CSS custom properties (`--rhrev-change-bar-*`). The side is always right in HTML (no recto/verso model), and a marked section's bar spans its nested subsections, unlike the PDF backend. Default styling (red right border) ships in the baiyibai UI bundle
6
+ * Fix the documented Assembler xref format example emitting a "possible invalid reference" warning by escaping the inline example
7
+ * Replace the figure example in the docs with an original image (gem and npm both 1.3.0)
8
+
9
+ == 1.2.3 (2026-07-15)
10
+
11
+ * Fix the initial-release table (revnumber `1.0`/`1` with `rhrev-initial-handling` `initial-release`) rendering a "Major changes since Revision X" header row: an initial release has no prior revision, so the table is now a single `Page | Initial Release` row (PDF backend, HTML backend, and Antora extension). Caption, custom first row, and all localization/customization attributes are unaffected; `rhrev-localization-major-changes` still applies to the regular revision-history table
12
+
3
13
  == 1.2.2 (2026-07-15)
4
14
 
5
15
  * 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
@@ -233,18 +233,10 @@ module Asciidoctor
233
233
 
234
234
  column_widths = get_column_widths doc
235
235
  table_data = []
236
-
236
+
237
237
  page_label = doc.attr 'rhrev-localization-page', 'Page'
238
- major_changes_text = doc.attr 'rhrev-localization-major-changes', 'Major changes since'
239
-
240
- revision_label = doc.attr('version-label', 'Revision')
241
- revnumber = doc.attr('revnumber')
242
-
243
- header_text = "*#{major_changes_text} #{revision_label} #{revnumber}*"
244
- table_data << ["*#{page_label}*", header_text]
245
-
246
238
  initial_text = doc.attr 'rhrev-customization-initial-release-text', 'Initial Release'
247
- table_data << ["", initial_text]
239
+ table_data << ["*#{page_label}*", initial_text]
248
240
 
249
241
  formatted_widths = column_widths.map { |w| w.to_i.to_s }.join(',')
250
242
  markup_lines = []
@@ -5,6 +5,49 @@ require 'asciidoctor/converter/html5'
5
5
 
6
6
  module Asciidoctor
7
7
  module Rhrev
8
+ # Tags blocks marked with the current revision (revnumber 1.2 => attribute
9
+ # rhrev1-2) with the rhrev-changed role so a stylesheet can draw an HTML
10
+ # change bar (border on the right side). Enabled by the rhrev-change-bars
11
+ # document attribute, mirroring the PDF backend. The rhrev-change-bars-color,
12
+ # -width, and -offset attributes are emitted as CSS custom properties; the
13
+ # side is always right in HTML output (no recto/verso model).
14
+ class ChangeBarsHtmlTreeprocessor < Asciidoctor::Extensions::Treeprocessor
15
+ TRACKED_CONTEXTS = [:section, :floating_title, :example, :listing, :table, :image].freeze
16
+
17
+ def process document
18
+ return document unless document.basebackend? 'html'
19
+ return document unless document.attr? 'rhrev-change-bars'
20
+ return document unless (revnumber = document.attr 'revnumber')
21
+ prefix = document.attr 'revhistoryprefix', 'rhrev'
22
+ change_attr = %(#{prefix}#{revnumber.to_s.tr '.', '-'})
23
+
24
+ tagged = false
25
+ document.find_by { |b| TRACKED_CONTEXTS.include? b.context }.each do |block|
26
+ next unless block.attributes && (block.attributes.key? change_attr)
27
+ roles = (block.attr 'role')
28
+ block.set_attr 'role', [roles, 'rhrev-changed'].compact.join(' ')
29
+ tagged = true
30
+ end
31
+ return document unless tagged
32
+
33
+ overrides = []
34
+ if (color = document.attr 'rhrev-change-bars-color')
35
+ overrides << %(--rhrev-change-bar-color: ##{color.to_s.delete_prefix '#'};)
36
+ end
37
+ if (width = document.attr 'rhrev-change-bars-width')
38
+ overrides << %(--rhrev-change-bar-width: #{width}px;)
39
+ end
40
+ if (offset = document.attr 'rhrev-change-bars-offset')
41
+ overrides << %(--rhrev-change-bar-offset: #{offset}px;)
42
+ end
43
+ unless overrides.empty?
44
+ style = create_block document, :pass, %(<style>:root { #{overrides.join ' '} }</style>), {}
45
+ document.blocks.unshift style
46
+ end
47
+ document
48
+ end
49
+ end
50
+
8
51
  # Treeprocessor to auto-inject revision history at document start
9
52
  class HtmlTreeprocessor < Asciidoctor::Extensions::Treeprocessor
10
53
  def process document
@@ -114,10 +157,7 @@ module Asciidoctor
114
157
 
115
158
  column_widths = doc.attr('rhrev-table-column-width', '30,70').split(',').map(&:strip)
116
159
  section_label = doc.attr('rhrev-localization-location', 'Section')
117
- major_changes_text = doc.attr('rhrev-localization-major-changes', 'Major changes since')
118
- version_label = doc.attr('version-label', 'Revision')
119
- revnumber = doc.attr('revnumber', '1.0')
120
-
160
+
121
161
  # Build table CSS classes with frame and grid
122
162
  frame = doc.attr('rhrev-table-frame', 'all')
123
163
  grid = doc.attr('rhrev-table-grid', 'all')
@@ -151,13 +191,9 @@ module Asciidoctor
151
191
  end
152
192
  end
153
193
 
154
- html << '<tr class="rhrev-header">'
155
- html << %(<th class="tableblock halign-left valign-top">#{section_label}</th>)
156
- html << %(<th class="tableblock halign-left valign-top"><strong>#{major_changes_text} #{version_label} #{revnumber}</strong></th>)
157
- html << '</tr>'
158
194
  html << '<tr>'
159
- html << '<td>&nbsp;</td>'
160
- html << %(<td>#{initial_text}</td>)
195
+ html << %(<th class="tableblock halign-left valign-top">#{section_label}</th>)
196
+ html << %(<td class="tableblock halign-left valign-top">#{initial_text}</td>)
161
197
  html << '</tr>'
162
198
  html << '</tbody>'
163
199
  html << '</table>'
@@ -31,4 +31,5 @@ Asciidoctor::Extensions.register do
31
31
  block_macro Asciidoctor::Rhrev::RhrevBlockMacroProcessor
32
32
  inline_macro Asciidoctor::Rhrev::PagerhrefInlineMacroProcessor
33
33
  treeprocessor Asciidoctor::Rhrev::HtmlTreeprocessor if html_available
34
+ treeprocessor Asciidoctor::Rhrev::ChangeBarsHtmlTreeprocessor if html_available
34
35
  end
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.2
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 白一百 baiyibai