From 2dff30cb39456efd67032f6b46214b879612d588 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Tue, 12 Sep 2023 11:38:03 +0200 Subject: [PATCH] docs: first bits for an Antora extension setting some AsciiDoc attributes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Fabrice Flore-Thébault --- antora-playbook.yml | 123 ++++++++++++++++---------------- docs/extensions/get-versions.js | 36 ++++++++++ 2 files changed, 98 insertions(+), 61 deletions(-) create mode 100644 docs/extensions/get-versions.js diff --git a/antora-playbook.yml b/antora-playbook.yml index 1da5bd6634..cee388d91b 100644 --- a/antora-playbook.yml +++ b/antora-playbook.yml @@ -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: " " - 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: " " + 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 diff --git a/docs/extensions/get-versions.js b/docs/extensions/get-versions.js new file mode 100644 index 0000000000..6ae95b95ee --- /dev/null +++ b/docs/extensions/get-versions.js @@ -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 }); + }); +};