Skip to content

Commit 3c275a7

Browse files
author
Farzad Hayatbakhsh
committed
DOC-2608: Move input and output file names into Antora playbook config
1 parent f99263d commit 3c275a7

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

antora-playbook-local.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ asciidoc:
1919
- '@tinymce/antora-extension-livedemos'
2020
antora:
2121
extensions:
22-
- './lib/rssfeed.cjs'
22+
- require: './lib/rssfeed.cjs'
23+
input_file: 'changelog.adoc'
24+
output_file: 'rss.xml'
2325
runtime:
2426
fetch: true

antora-playbook.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ asciidoc:
2121
- '@tinymce/antora-extension-livedemos'
2222
antora:
2323
extensions:
24-
- './lib/rssfeed.cjs'
24+
- require: './lib/rssfeed.cjs'
25+
input_file: 'changelog.adoc'
26+
output_file: 'rss.xml'
2527
runtime:
2628
fetch: true

lib/rssfeed.cjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22

33
const cheerio = require("cheerio");
44

5-
module.exports.register = function () {
5+
module.exports.register = function ({ config }) {
66
this.on("beforePublish", ({ siteCatalog, contentCatalog, playbook }) => {
77
try {
88
// Find the changelog page
9-
const page = contentCatalog.findBy({ basename: "changelog.adoc" })[0];
9+
const page = contentCatalog.findBy({
10+
basename: config.inputFile,
11+
})[0];
1012

1113
if (!page) {
12-
console.error("changelog.adoc page not found.");
13-
return;
14+
throw new Error(`${config.inputFile} page not found.`);
1415
}
1516

1617
// Destructure page attributes
@@ -92,8 +93,9 @@ module.exports.register = function () {
9293
// Add RSS feed to site catalog
9394
siteCatalog.addFile({
9495
contents: Buffer.from(rss),
95-
out: { path: "rss.xml" },
96+
out: { path: config.outputFile },
9697
});
98+
console.log(`RSS feed generated at ${config.outputFile}`);
9799
} catch (error) {
98100
// Catch any errors to allow the build to continue
99101
console.error("Error generating RSS feed:", error);

0 commit comments

Comments
 (0)