From 5d9a3ef416ab9e0d0fb81440485965bd349d9085 Mon Sep 17 00:00:00 2001 From: Dan Allen Date: Fri, 26 Jan 2024 16:19:11 -0700 Subject: [PATCH] update playbook to use draft content; activate kroki extension --- .github/workflows/publish-site.yml | 2 +- antora-playbook.yml | 11 +++++++++-- lib/register-asciidoctor-kroki-extension.js | 12 ++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 lib/register-asciidoctor-kroki-extension.js diff --git a/.github/workflows/publish-site.yml b/.github/workflows/publish-site.yml index 6cb73f9..4e496cf 100644 --- a/.github/workflows/publish-site.yml +++ b/.github/workflows/publish-site.yml @@ -29,7 +29,7 @@ jobs: with: node-version: '18' - name: Generate Site - run: npx -y antora --html-url-extension-style=indexify antora-playbook.yml + run: npx -y --package antora --package asciidoctor-kroki antora --stacktrace --html-url-extension-style=indexify antora-playbook.yml - name: Upload Artifact uses: actions/upload-pages-artifact@v2 - name: Deploy Artifact to GitHub Pages diff --git a/antora-playbook.yml b/antora-playbook.yml index 26b95c7..4a8ff0f 100644 --- a/antora-playbook.yml +++ b/antora-playbook.yml @@ -1,6 +1,13 @@ -# npx antora antora-playbook.yml +# to build site, use: +# +# npx antora antora-playbook.yml +# +# to also activate diagram generator (Kroki), use: +# +# npx --package antora --package asciidoctor-kroki antora antora-playbook.yml antora: extensions: + - ./lib/register-asciidoctor-kroki-extension.js - ./lib/component-url-prefix-extension.js site: title: Eclipse Jetty @@ -12,7 +19,7 @@ content: start_paths: [home, docs-home, contribution-guide] - url: https://github.com/opendevise/jetty.project branches: jetty-12.0.x-for-antora - start_path: documentation/jetty-docs + start_path: documentation/jetty asciidoc: attributes: experimental: '' diff --git a/lib/register-asciidoctor-kroki-extension.js b/lib/register-asciidoctor-kroki-extension.js new file mode 100644 index 0000000..62c1f12 --- /dev/null +++ b/lib/register-asciidoctor-kroki-extension.js @@ -0,0 +1,12 @@ +'use strict' + +module.exports.register = function () { + this.on('playbookBuilt', ({ playbook }) => { + try { + this.require('asciidoctor-kroki') + // or... + //require.resolve('asciidoctor-kroki', { paths: this.module.require.main.paths }) + playbook.asciidoc.extensions.push('asciidoctor-kroki') + } catch {} + }) +}