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 +4 -4
- data/CHANGELOG.adoc +6 -0
- data/lib/asciidoctor/rhrev/rhrev_html.rb +43 -0
- data/lib/asciidoctor/rhrev.rb +1 -0
- 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: cdb14bf628d2c8dd088c5f7f9a37012305efc17fd2c6f6717a4e6a08d3e9ac18
|
|
4
|
+
data.tar.gz: b8bbabee8370433715fc06a11259fae8ac7eb80e7821965aa2b348fbcd185bcb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
data/lib/asciidoctor/rhrev.rb
CHANGED
|
@@ -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
|