asciidoctor-autoterm 1.0.5 → 1.0.6
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 +5 -0
- data/README.adoc +24 -1
- data/lib/asciidoctor/autoterm/antora_processor.rb +29 -2
- data/lib/asciidoctor/autoterm/version.rb +1 -1
- 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: c048e78c3879fd1f6499635746910ce0d10be44248308f9c3cd3e8a42dd0e273
|
|
4
|
+
data.tar.gz: 73c8ee930a26cd91a0c8e596877bbd62bda0751d1d78066521bdbe7721d19ff4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: af6a59f777c5c38859024888dffbcc5657cf159a9240daf1fdae69505a87aec7298ca24866bea236a9b5d27383a70afd0f0000ee0664eb5151c156080f69df2b
|
|
7
|
+
data.tar.gz: 4d2c0eb31572bfaad3d166e1f94500ba14d7f1d2732c81d94143e55e03e741adca3b55793771e2bd06cbc003940014276169f48c6ddb5863880ede2fcf167bef
|
data/CHANGELOG.adoc
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to `asciidoctor-autoterm` are documented here.
|
|
4
4
|
|
|
5
|
+
== 1.0.6 (2026-08-01)
|
|
6
|
+
|
|
7
|
+
* Fixed: `antora-extension/index.js` adds a `nav.adoc` entry tagged `role=hidden` for each stub page. Required for the Assembler's merge to include the stub in the fused PDF document; the 1.0.5 extension omitted it, so a page `xref` to `terminology.adoc`/`index-page.adoc` never resolved to an in-document PDF link. See README.adoc
|
|
8
|
+
* Fixed: `antora_processor.rb` finds the placeholder chapter `antora-extension/index.js` adds and mutates it in place into the real Terminology/Index section, instead of always appending a new one. Appending unconditionally left the placeholder as an empty, separately-ID'd chapter, so a correctly-resolved `xref` pointed at the empty placeholder, not the generated content. See README.adoc
|
|
9
|
+
|
|
5
10
|
== 1.0.5 (2026-08-01)
|
|
6
11
|
|
|
7
12
|
* Added: `antora-extension/index.js`, a companion Antora extension that registers publishable Terminology and Index stub pages so `xref` targets resolve. Published separately as `@baiyibai-asciidoctor/autoterm`; not shipped in the gem. See README.adoc
|
data/README.adoc
CHANGED
|
@@ -91,7 +91,9 @@ More information on using the Index with Antora Assembler is available at these
|
|
|
91
91
|
|
|
92
92
|
== Antora HTML Site: Resolving `xref` Targets for Terminology and Index
|
|
93
93
|
|
|
94
|
-
`@baiyibai-asciidoctor/autoterm` is an Antora Node.js extension that assists asciidoctor-pdf and antora-assembler
|
|
94
|
+
`@baiyibai-asciidoctor/autoterm` is an Antora Node.js extension that assists asciidoctor-pdf and antora-assembler.
|
|
95
|
+
It registers publishable Terminology and Index stub pages, each with a `nav.adoc` entry tagged `role=hidden`, so `xref` targets to them resolve and the Assembler's merge includes them in the same document.
|
|
96
|
+
Starting at 1.0.5, the gem's tree-processor finds each stub by its title and mutates it in place into the real section, instead of appending a duplicate.
|
|
95
97
|
Wrap a source reference to either page in `ifdef::loader-assembler[]` and `endif::[]` so it renders only for the PDF build.
|
|
96
98
|
|
|
97
99
|
[source,yaml]
|
|
@@ -101,3 +103,24 @@ antora:
|
|
|
101
103
|
- require: '@baiyibai-asciidoctor/autoterm'
|
|
102
104
|
----
|
|
103
105
|
|
|
106
|
+
[IMPORTANT]
|
|
107
|
+
====
|
|
108
|
+
`role=hidden` carries no built-in meaning for Antora or its default UI.
|
|
109
|
+
A consuming UI bundle's nav template MUST skip rendering an item carrying that role, or the stub pages appear in the HTML site's navigation.
|
|
110
|
+
For a Handlebars-based UI bundle derived from `@antora/ui-default`, wrap the item in `partials/nav-tree.hbs`:
|
|
111
|
+
|
|
112
|
+
[source,hbs]
|
|
113
|
+
----
|
|
114
|
+
{{#unless (includes ./roles 'hidden')}}
|
|
115
|
+
<!-- existing <li> markup -->
|
|
116
|
+
{{/unless}}
|
|
117
|
+
----
|
|
118
|
+
|
|
119
|
+
with an `includes` helper:
|
|
120
|
+
|
|
121
|
+
[source,js]
|
|
122
|
+
----
|
|
123
|
+
module.exports = (arr, val) => Array.isArray(arr) && arr.includes(val)
|
|
124
|
+
----
|
|
125
|
+
====
|
|
126
|
+
|
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
Asciidoctor::Extensions.register do
|
|
2
2
|
tree_processor do
|
|
3
3
|
process do |doc|
|
|
4
|
+
# A page xref to a real Antora page (xref:terminology.adoc[]) resolves to
|
|
5
|
+
# whatever section the Antora Assembler's rewriter computed for that page,
|
|
6
|
+
# not to a section this tree-processor creates fresh: the rewriter runs
|
|
7
|
+
# before this tree-processor, against a page that does not carry the real
|
|
8
|
+
# content yet. Creating a brand new section unconditionally, as this used
|
|
9
|
+
# to do, produces a second, differently-ID'd "Terminology"/"Index"
|
|
10
|
+
# section, leaving the fused page's own empty placeholder chapter in
|
|
11
|
+
# place with the ID any such xref actually resolves to.
|
|
12
|
+
#
|
|
13
|
+
# antora-extension/index.js registers that placeholder chapter (titled
|
|
14
|
+
# exactly "Terminology" / "Index") when include-terminology /
|
|
15
|
+
# include-index is set, so this tree-processor finds and mutates it in
|
|
16
|
+
# place instead of appending a new section, keeping it at the ID any
|
|
17
|
+
# page xref already resolved to. Standalone (non-Antora) usage, where no
|
|
18
|
+
# such placeholder exists, falls back to appending a new section as
|
|
19
|
+
# before.
|
|
4
20
|
if doc.attributes['include-terminology'] == 'true'
|
|
5
|
-
if (
|
|
21
|
+
if (existing = doc.find_by(context: :section) { |s| s.level == 1 && s.title == 'Terminology' }.first)
|
|
22
|
+
existing.sectname = 'index'
|
|
23
|
+
existing.special = true
|
|
24
|
+
existing.set_attr 'type', 'terminology'
|
|
25
|
+
existing.set_attr 'sectnums', nil
|
|
26
|
+
existing.numbered = false
|
|
27
|
+
elsif (last_section = doc.sections.last)
|
|
6
28
|
terminology_section = create_section last_section.parent, 'Terminology', { 'style' => 'index', 'type' => 'terminology' }, numbered: false
|
|
7
29
|
terminology_section.parent << terminology_section
|
|
8
30
|
end
|
|
9
31
|
end
|
|
10
32
|
if doc.attributes['include-index'] == 'true'
|
|
11
|
-
if (
|
|
33
|
+
if (existing = doc.find_by(context: :section) { |s| s.level == 1 && s.title == 'Index' }.first)
|
|
34
|
+
existing.sectname = 'index'
|
|
35
|
+
existing.special = true
|
|
36
|
+
existing.set_attr 'sectnums', nil
|
|
37
|
+
existing.numbered = false
|
|
38
|
+
elsif (last_section = doc.sections.last)
|
|
12
39
|
index_section = create_section last_section.parent, 'Index', { 'style' => 'index' }, numbered: false
|
|
13
40
|
index_section.parent << index_section
|
|
14
41
|
end
|