Skip to content

Commit 7021bd0

Browse files
committed
Add french locale in antora configuration
1 parent 44687db commit 7021bd0

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

antora-playbook.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ content:
1212
start_path: docs/en
1313
branches: [release/0.30-stable, release/0.29-stable, release/0.28-stable, release/0.27-stable, develop]
1414
edit_url: "https://github.com/decidim/documentation/edit/{refname}/{path}"
15+
- url: &documentation https://github.com/decidim/documentation
16+
start_path: docs/fr
17+
branches: [develop]
1518
- url: https://github.com/decidim/decidim
1619
start_path: docs
1720
branches: [release/0.30-stable, release/0.29-stable, release/0.28-stable, release/0.27-stable, develop]

bin/playbook-changer.js

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,27 @@ async function getMetadataFromEnvironment() {
9898
// @param {string} metadata.headRef - the head reference of git
9999
// It's the name of the current branch
100100
function writeToFile(antoraPlaybookFile, metadata) {
101-
fs.readFile(antoraPlaybookFile, "utf8", function (err,data) {
101+
fs.readFile(antoraPlaybookFile, "utf8", function (err, data) {
102102
if (err) {
103-
return console.err(err);
103+
return console.error(err);
104104
}
105105

106-
let result = data.replace(metadata.baseRef, metadata.headRef);
106+
let result = data;
107107

108108
const isDevelopment = metadata.headRef === "HEAD";
109+
110+
// Only modify inside documentation sources
111+
result = result.replace(
112+
/(- url: &documentation[^\n]*\n(?:\s+.*\n)*?\s+branches:\s*\[[^\]]*?),\s*develop(\s*\])/gm,
113+
`$1, ${metadata.headRef}$2`
114+
);
115+
109116
if (isDevelopment) {
110-
const antoraDocumentationUrl = "https://github.com/decidim/documentation";
111-
result = result.replace(antoraDocumentationUrl, ".");
117+
// Replace only the documentation URLs, not the decidim/decidim one
118+
result = result.replace(
119+
/^(\s*-\s*url:\s*&documentation\s*)https:\/\/github\.com\/decidim\/documentation/mg,
120+
"$1."
121+
);
112122
}
113123

114124
console.log("********************************")
@@ -118,7 +128,7 @@ function writeToFile(antoraPlaybookFile, metadata) {
118128

119129
fs.writeFile(antoraPlaybookFile, result, "utf8", function (err) {
120130
if (err) {
121-
return console.err(err);
131+
return console.error(err);
122132
}
123133
});
124134
});

docs/fr/antora.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: fr
2+
title: "Decidim Documentation"
3+
version: develop
4+
asciidoc:
5+
attributes:
6+
page-lang: fr@
7+
nav:
8+
- modules/ROOT/nav.adoc

0 commit comments

Comments
 (0)