@redpanda-data/docs-extensions-and-macros 3.5.5 → 3.5.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.
package/README.adoc CHANGED
@@ -38,17 +38,17 @@ When you have Node.js installed, use the following command to install the `antor
38
38
  npm i @redpanda-data/docs-extensions-and-macros
39
39
  ----
40
40
 
41
- To use the development version instead, refer to the <<development-quickstart,Development Quickstart>>.
41
+ To use the development version, refer to the <<development-quickstart,Development Quickstart>>.
42
42
 
43
43
  == Antora Extensions
44
44
 
45
- This section documents the Antora extensions that are provided by this library and how to configure them.
45
+ This section documents the Antora extensions provided by this library and how to configure them.
46
46
 
47
47
  IMPORTANT: Ensure you register each extension under the `antora.extensions` key in the playbook, not the `asciidoc.extensions` key.
48
48
 
49
49
  === Algolia indexer
50
50
 
51
- This extension generates an Algolia index for each version of each component. The index entries are then saved to Algolia using the `saveObjects()` method, and also saved as JSON files in the site catalog. JSON files are published to the site root using the following template: `algolia-<component>-<version>.json`.
51
+ This extension generates an Algolia index for each version of each component. The index entries are then saved to Algolia using the `saveObjects()` method, and also saved as JSON files in the site catalog. JSON files are published to the site root using the template `algolia-<component>-<version>.json`.
52
52
 
53
53
  NOTE: Only pages that include an `<article>` element with the `doc` class are indexed.
54
54
 
@@ -127,9 +127,19 @@ antora:
127
127
 
128
128
  This extension fetches the latest release versions from GitHub.
129
129
 
130
- The latest versions of Redpanda Console and Redpanda Connect are made available to all versions of all Antora components.
130
+ The following attributes are available to all versions of all Antora components:
131
131
 
132
- The latest Redpanda version and the latest Redpanda Operator version are made available to the latest version of the `ROOT` component (Redpanda docs).
132
+ `latest-console-version`: The latest release version of Redpanda Console.
133
+ `latest-connect-version`: The latest release version of Redpanda Connect.
134
+ `redpanda-beta-version`: The latest RC version of Redpanda.
135
+ `redpanda-beta-commit`: The commit hash for the latest RC version of Redpanda.
136
+
137
+ The following attributes are available to the latest version of the `ROOT` component (Redpanda docs):
138
+
139
+ `full-version`: The latest release version of Redpanda.
140
+ `latest-release-commit`: The commit hash for the latest release version of Redpanda.
141
+ `latest-operator-version`: The latest release version of the Redpanda Operator.
142
+ `latest-redpanda-helm-chart-version`: The latest release version of the Redpanda Helm chart.
133
143
 
134
144
  ==== Environment variables
135
145
 
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  module.exports.register = function () {
4
+ const sanitizeAttributeValue = (value) => String(value).replace("@", "");
4
5
  this.on('contentClassified', ({ contentCatalog }) => {
5
6
  const componentVersionTable = contentCatalog.getComponents().reduce((componentMap, component) => {
6
7
  componentMap[component.name] = component.versions.reduce((versionMap, componentVersion) => {
@@ -20,13 +21,30 @@ module.exports.register = function () {
20
21
  return accum;
21
22
  }, {});
22
23
  let modified;
23
- const result = attachment.contents.toString().replace(/\{([\p{Alpha}\d_][\p{Alpha}\d_-]*)\}/gu, (match, name) => {
24
+ let contentString = attachment.contents.toString();
25
+ // Specific replacements for YAML files
26
+ if (attachment.out.path.endsWith('.yaml') || attachment.out.path.endsWith('.yml')) {
27
+ const redpandaVersionRegex = /(\$\{REDPANDA_VERSION[^\}]*\})/g;
28
+ const redpandaConsoleVersionRegex = /(\$\{REDPANDA_CONSOLE_VERSION[^\}]*\})/g;
29
+ let fullVersion = attributes['full-version'] ? sanitizeAttributeValue(attributes['full-version']) : '';
30
+ const latestConsoleVersion = attributes['latest-console-version'] ? sanitizeAttributeValue(attributes['latest-console-version']) : '';
31
+
32
+ if (attributes['page-component-version-is-prerelease'] === 'true') {
33
+ fullVersion = attributes['redpanda-beta-version'] ? sanitizeAttributeValue(attributes['redpanda-beta-version']) : fullVersion;
34
+ }
35
+
36
+ contentString = contentString.replace(redpandaVersionRegex, fullVersion);
37
+ contentString = contentString.replace(redpandaConsoleVersionRegex, latestConsoleVersion);
38
+ }
39
+
40
+ const result = contentString.replace(/\{([\p{Alpha}\d_][\p{Alpha}\d_-]*)\}/gu, (match, name) => {
24
41
  if (!(name in attributes)) return match;
25
42
  modified = true;
26
43
  let value = attributes[name];
27
44
  if (value.endsWith('@')) value = value.slice(0, value.length - 1);
28
45
  return value;
29
46
  });
47
+
30
48
  if (modified) attachment.contents = Buffer.from(result);
31
49
  });
32
50
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redpanda-data/docs-extensions-and-macros",
3
- "version": "3.5.5",
3
+ "version": "3.5.6",
4
4
  "description": "Antora extensions and macros developed for Redpanda documentation.",
5
5
  "keywords": [
6
6
  "antora",