diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 917cfa66..222e443a 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -13,5 +13,12 @@ jobs: steps: - name: Checkout Current Repo uses: actions/checkout@v4 + - name: Test install +# run: npm i git+https://${{ github.token }}@github.com/hazelcast/hazelcast-docs-tools.git#v0.0.1-alpha + run: | + npm i git+https://${{ secrets.GH_TOKEN_DOCS_TOOLS }}@github.com/hazelcast/hazelcast-docs-tools - name: Check dead links uses: hazelcast/hazelcast-docs/.github/actions/validate@main + - name: Check orphan pages + shell: bash + run: npm run check-orphan-pages diff --git a/antora-playbook-local.yml b/antora-playbook-local.yml index 217d65fe..ddc9cf13 100644 --- a/antora-playbook-local.yml +++ b/antora-playbook-local.yml @@ -36,5 +36,5 @@ asciidoc: docs-archive: 'https://hazelcast.org/imdg/download/archives/' hazelcast-cloud: Cloud extensions: - - ./lib/tabs-block.js - - ./lib/swagger-ui-block-macro.js + - ./node_modules/hazelcast-docs-tools/antora-macro/tabs-block.js + - ./node_modules/hazelcast-docs-tools/antora-macro/swagger-ui-block-macro.js diff --git a/antora-playbook.yml b/antora-playbook.yml index 9c94a45c..d593ae6e 100644 --- a/antora-playbook.yml +++ b/antora-playbook.yml @@ -35,5 +35,5 @@ asciidoc: docs-archive: 'https://hazelcast.org/imdg/download/archives/' hazelcast-cloud: Cloud extensions: - - ./lib/tabs-block.js - - ./lib/swagger-ui-block-macro.js + - ./node_modules/hazelcast-docs-tools/antora-macro/tabs-block.js + - ./node_modules/hazelcast-docs-tools/antora-macro/swagger-ui-block-macro.js diff --git a/docs/modules/getting-started/partials/nav.adoc b/docs/modules/getting-started/partials/nav.adoc index 75d2c922..3502220e 100644 --- a/docs/modules/getting-started/partials/nav.adoc +++ b/docs/modules/getting-started/partials/nav.adoc @@ -6,4 +6,4 @@ ** User Interface Overview *** xref:getting-started:user-interface.adoc[Top Bar and Side Bar] *** xref:getting-started:graphs.adoc[] -*** xref:getting-started:tables.adoc[] \ No newline at end of file +*** xref:getting-started:tables.adoc[] diff --git a/lib/swagger-ui-block-macro.js b/lib/swagger-ui-block-macro.js deleted file mode 100644 index 1c497ce1..00000000 --- a/lib/swagger-ui-block-macro.js +++ /dev/null @@ -1,20 +0,0 @@ -const buildSwaggerUi = ({ specUrl }) => ` - - -` - -function blockSwaggerUiMacro ({ file }) { - return function () { - this.process((parent, specUrl) => { - specUrl = `${specUrl}` - const contentScripts = buildSwaggerUi({ specUrl }) - return this.createBlock(parent, 'pass', contentScripts) - }) - } -} - -function register (registry, context) { - registry.blockMacro('swagger_ui', blockSwaggerUiMacro(context)) -} - -module.exports.register = register diff --git a/lib/tabs-block.js b/lib/tabs-block.js deleted file mode 100644 index ae47e18d..00000000 --- a/lib/tabs-block.js +++ /dev/null @@ -1,80 +0,0 @@ -/* Copyright (c) 2018 OpenDevise, Inc. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -/** - * Extends the AsciiDoc syntax to support a tabset. The tabset is created from - * a dlist enclosed in an example block that is marked with the tabs style. - * - * Usage: - * - * [tabs] - * ==== - * Tab A:: - * + - * -- - * Contents of tab A. - * -- - * Tab B:: - * + - * -- - * Contents of tab B. - * -- - * ==== - * - * @author Dan Allen - */ -const IdSeparatorCh = '-' -const ExtraIdSeparatorsRx = /^-+|-+$|-(-)+/g -const InvalidIdCharsRx = /[^a-zA-Z0-9_]/g -const List = Opal.const_get_local(Opal.module(null, 'Asciidoctor'), 'List') -const ListItem = Opal.const_get_local(Opal.module(null, 'Asciidoctor'), 'ListItem') - -const generateId = (str, idx) => - `tabset${idx}_${str.toLowerCase().replace(InvalidIdCharsRx, IdSeparatorCh).replace(ExtraIdSeparatorsRx, '$1')}` - -function tabsBlock () { - this.onContext('example') - this.process((parent, reader, attrs) => { - const createHtmlFragment = (html) => this.createBlock(parent, 'pass', html) - const tabsetIdx = parent.getDocument().counter('idx-tabset') - const nodes = [] - nodes.push(createHtmlFragment('
')) - const container = this.parseContent(this.createBlock(parent, 'open'), reader) - const sourceTabs = container.getBlocks()[0] - if (!(sourceTabs && sourceTabs.getContext() === 'dlist' && sourceTabs.getItems().length)) return - const tabs = List.$new(parent, 'ulist') - tabs.addRole('tabs') - const panes = {} - sourceTabs.getItems().forEach(([[title], details]) => { - const tab = ListItem.$new(tabs) - tabs.$append(tab) - const id = generateId(title.getText(), tabsetIdx) - tab.text = `[[${id}]]${title.text}` - let blocks = details.getBlocks() - const numBlocks = blocks.length - if (numBlocks) { - if (blocks[0].context === 'open' && numBlocks === 1) blocks = blocks[0].getBlocks() - panes[id] = blocks.map((block) => (block.parent = parent) && block) - } - }) - nodes.push(tabs) - nodes.push(createHtmlFragment('
')) - Object.entries(panes).forEach(([id, blocks]) => { - nodes.push(createHtmlFragment(`
`)) - nodes.push(...blocks) - nodes.push(createHtmlFragment('
')) - }) - nodes.push(createHtmlFragment('
')) - nodes.push(createHtmlFragment('
')) - parent.blocks.push(...nodes) - }) -} - -function register (registry) { - registry.block('tabs', tabsBlock) -} - -module.exports.register = register diff --git a/package-lock.json b/package-lock.json index 11c12b0f..4610d235 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,9 @@ "name": "hazelcast-docs-playbook", "version": "1.0.0", "license": "ISC", + "dependencies": { + "hazelcast-docs-tools": "github:hazelcast/hazelcast-docs-tools#v0.0.1-alpha" + }, "devDependencies": { "@antora/cli": "^3.1.1", "@antora/site-generator": "^3.1.1", @@ -1403,6 +1406,18 @@ "node": ">=4" } }, + "node_modules/hazelcast-docs-tools": { + "version": "1.0.0", + "resolved": "git+ssh://git@github.com/hazelcast/hazelcast-docs-tools.git#7aad443c375e06a7d27d70680eeb3b089b2ff948", + "license": "ISC", + "bin": { + "check-orphan-pages": "bin/check-orphan-pages.js" + }, + "engines": { + "node": ">=20.0.0", + "npm": ">=10.0.0" + } + }, "node_modules/help-me": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/help-me/-/help-me-5.0.0.tgz", diff --git a/package.json b/package.json index ce7448e3..34b0f1a7 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "scripts": { "build": "antora --to-dir docs --fetch antora-playbook.yml", "build-local": "antora --to-dir test --fetch antora-playbook-local.yml", + "check-orphan-pages": "check-orphan-pages", "serve": "serve test", "expose": "ngrok http 5000" },