Skip to content

Commit

Permalink
docs: first bits for an Antora extension setting some AsciiDoc attrib…
Browse files Browse the repository at this point in the history
…utes

Signed-off-by: Fabrice Flore-Thébault <[email protected]>
  • Loading branch information
themr0c committed Sep 12, 2023
1 parent e369b62 commit 2dff30c
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 61 deletions.
123 changes: 62 additions & 61 deletions antora-playbook.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,70 @@
---
site:
title: CRC Documentation
start_page: getting_started:getting_started:introducing.adoc
url: https://crc.dev
robots: allow
title: CRC Documentation
start_page: getting_started:getting_started:introducing.adoc
url: https://crc.dev
robots: allow
content:
sources:
- url: ./ # Point to Git repository
branches: HEAD # Use local conntent
edit_url: "https://github.com/crc-org/crc/edit/main/{path}"
start_path: docs # Point to docs content
sources:
- url: ./ # Point to Git repository
branches: HEAD # Use local conntent
edit_url: "https://github.com/crc-org/crc/edit/main/{path}"
start_path: docs # Point to docs content
output:
clean: true # Delete stale content
dir: docs/build
clean: true # Delete stale content
dir: docs/build
runtime:
cache_dir: .cache/antora # Use a local directory rather than $HOME
log:
failure_level: warn # Fail on missing attributes
level: debug # Extra verbose
cache_dir: .cache/antora # Use a local directory rather than $HOME
log:
failure_level: warn # Fail on missing attributes
level: debug # Extra verbose
ui:
bundle:
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable
snapshot: true
supplemental_files: docs/supplemental-ui
bundle:
url: https://gitlab.com/antora/antora-ui-default/-/jobs/artifacts/HEAD/raw/build/ui-bundle.zip?job=bundle-stable
snapshot: true
supplemental_files: docs/supplemental-ui
urls:
html_extension_style: indexify
redirect_facility: static
#antora:
# extensions:
# - '@antora/lunr-extension'
html_extension_style: indexify
redirect_facility: static
antora:
extensions:
# - "@antora/lunr-extension"
- ./docs/extensions/get-versions.js
asciidoc:
sourcemap: true
attributes:
icons: font
nbsp: "&#160;"
project-context: crc
# Platforms
rh: "Red{nbsp}Hat"
rhel: "Red{nbsp}Hat Enterprise{nbsp}Linux"
fed: Fedora
centos: CentOS
mac: macOS
msw: Microsoft Windows
debian: Debian
ubuntu: Ubuntu
openshift: OpenShift
ocp: OpenShift Container Platform
okd: OKD
ushift: MicroShift
# Product naming
prod: CRC
rh-prod: CRC
bin: crc
# Documentation naming
context: crc
crc-gsg: CRC Getting Started Guide
# URLs
crc-download-url: https://console.redhat.com/openshift/create/local
crc-gsg-url: https://crc-org.github.io/crc/
openshift-installer-url: https://console.redhat.com/openshift/install
openshift-docs-url: https://docs.openshift.com/container-platform/latest
openshift-docs-url-landing-page: "{openshift-docs-url}/welcome/index.html#developer-activities"
oc-download-url: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/
odo-docs-url: "{openshift-docs-url}/cli_reference/developer_cli_odo/understanding-odo.html"
odo-docs-url-installing: "{openshift-docs-url}/cli_reference/developer_cli_odo/installing-odo.html"
odo-docs-url-single-component: "{openshift-docs-url}/cli_reference/developer_cli_odo/creating_and_deploying_applications_with_odo/creating-a-single-component-application-with-odo.html"
telemetry-notice-url: https://developers.redhat.com/article/tool-data-collection
rhel-resolved-docs: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/using-different-dns-servers-for-different-domains_configuring-and-managing-networking
sourcemap: true
attributes:
icons: font
nbsp: "&#160;"
project-context: crc
# Platforms
rh: "Red{nbsp}Hat"
rhel: "Red{nbsp}Hat Enterprise{nbsp}Linux"
fed: Fedora
centos: CentOS
mac: macOS
msw: Microsoft Windows
debian: Debian
ubuntu: Ubuntu
openshift: OpenShift
ocp: OpenShift Container Platform
okd: OKD
ushift: MicroShift
# Product naming
prod: CRC
rh-prod: CRC
bin: crc
# Documentation naming
context: crc
crc-gsg: CRC Getting Started Guide
# URLs
crc-download-url: https://console.redhat.com/openshift/create/local
crc-gsg-url: https://crc-org.github.io/crc/
openshift-installer-url: https://console.redhat.com/openshift/install
openshift-docs-url: https://docs.openshift.com/container-platform/latest
openshift-docs-url-landing-page: "{openshift-docs-url}/welcome/index.html#developer-activities"
oc-download-url: https://mirror.openshift.com/pub/openshift-v4/clients/ocp/latest/
odo-docs-url: "{openshift-docs-url}/cli_reference/developer_cli_odo/understanding-odo.html"
odo-docs-url-installing: "{openshift-docs-url}/cli_reference/developer_cli_odo/installing-odo.html"
odo-docs-url-single-component: "{openshift-docs-url}/cli_reference/developer_cli_odo/creating_and_deploying_applications_with_odo/creating-a-single-component-application-with-odo.html"
telemetry-notice-url: https://developers.redhat.com/article/tool-data-collection
rhel-resolved-docs: https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html/configuring_and_managing_networking/using-different-dns-servers-for-different-domains_configuring-and-managing-networking
36 changes: 36 additions & 0 deletions docs/extensions/get-versions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict";
require("fs");
module.exports.register = function () {
this.on("playbookBuilt", function ({ playbook }) {
// Set default values
const ocp_ver = "4.13";
const ocp_ver_full = "4.13.9";
const podman_ver = "4.4.4";
const prod_ver = "2.26";
const prod_ver_full = "2.26.0";
const ushift_ver = "4.13.9";
// Read the external file
try {
const data = fs.readFileSync("Makefile", "utf8");
// console.log(data);
} catch (err) {
console.error(err);
}
// TODO: Parse the content to get the variables values
// OPENSHIFT_VERSION ?= 4.13.9
// PODMAN_VERSION ?= 4.4.4
// OKD_VERSION ?= 4.13.0-0.okd-2023-06-04-080300
// MICROSHIFT_VERSION ?= 4.13.9
// CRC_VERSION = 2.26.0
// Set attributes values
Object.assign(playbook.asciidoc.attributes, {
"ocp-ver": ocp_ver,
"ocp-ver-full": ocp_ver_full,
"podman-ver": podman_ver,
"prod-ver": prod_ver,
"prod-ver-full": prod_ver_full,
"ushift-ver": ushift_ver,
});
this.updateVariables({ playbook });
});
};

0 comments on commit 2dff30c

Please sign in to comment.