asciidoctor-rhrev 1.2.3 → 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: 87f9419e740ba6f0002e1a4fd06c2930319910ff2a3bf2fbeeefbfee33d6c0d3
4
- data.tar.gz: 2c6759b77bd7c9ab7d16e906a569541c36a185a594f45b0e398e2f028087e0bc
3
+ metadata.gz: cdb14bf628d2c8dd088c5f7f9a37012305efc17fd2c6f6717a4e6a08d3e9ac18
4
+ data.tar.gz: b8bbabee8370433715fc06a11259fae8ac7eb80e7821965aa2b348fbcd185bcb
5
5
  SHA512:
6
- metadata.gz: d939d3d0be086e54ef94165c96532594992d45adf7d3f93cd1b1d64b2667db5bddfdfc6566252b7dc0b830536c46c2dc822c313d19477ec78c0e8dfbb816905a
7
- data.tar.gz: 9918859a0819b3ad98926199f499eab62ff3185cd012f31b0c45fe5b8f76ae310c6fcdb9ab3096fa256335b2d5cdd42fb1f1a739e6cbba53e8db9da5c3fbb654
6
+ metadata.gz: a253125687474c408d3d89545d2c66d35f944a5330cb7e99213672bafcdcf199083a4528379b801a035726e0badd9ebd321101ebb27a9b2e3f3bd02e4a2be314
7
+ data.tar.gz: 8f4e7888fdbf89ba4a70705b97eed4aa4a05bc5b19e0b5ab96bbd4b295db47757b4d73b724b84243c724098ab4578c844cc9ee3564df655d9831c3adb5021e48
data/CHANGELOG.adoc CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  == 1.2.3 (2026-07-15)
4
10
 
5
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
@@ -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
@@ -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.3
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - 白一百 baiyibai