Skip to content

Commit 4b90286

Browse files
committed
fix: Link handling
1 parent df20aca commit 4b90286

File tree

3 files changed

+7
-20
lines changed

3 files changed

+7
-20
lines changed

packages/quickstart/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We first introduce you to the basic development paradigms like *Model-View-Contr
88

99
### Preview
1010

11-
![Preview of the OpenUI5 application that is going to be built in this tutorial. Contains a Hello World upper part with buttons and a text input. The lower part shows list of invoices with details, grouped by vendor names.](assets/loiofb12cea5ac9b45bb9007aac5a1a8689f_LowRes.png)
11+
![Preview of the OpenUI5 application that is going to be built in this tutorial. Contains a Hello World upper part with buttons and a text input. The lower part shows list of invoices with details, grouped by vendor names.](steps/03/assets/loio79e1157d948c488c9717ef840fa9b396_LowRes.png).
1212

1313
> 💡 **Tip:** <br>
1414
> You don't have to do all tutorial steps sequentially, you can also jump directly to any step you want. Just download the code from the previous step and make sure that the application runs as intended.

packages/walkthrough/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ We first introduce you to the basic development paradigms like *Model-View-Contr
88

99
### Preview
1010

11-
![Preview of the OpenUI5 application that is going to be built in this tutorial. Contains a Hello World upper part with buttons and a text input. The lower part shows list of invoices with details, grouped by vendor names.](assets/loiofb12cea5ac9b45bb9007aac5a1a8689f_LowRes.png)
11+
![Preview of the OpenUI5 application that is going to be built in this tutorial. Contains a Hello World upper part with buttons and a text input. The lower part shows list of invoices with details, grouped by vendor names.](steps/38/assets/loiofb12cea5ac9b45bb9007aac5a1a8689f_LowRes.png)
1212

1313
> 💡 **Tip:** <br>
1414
> You don't have to do all tutorial steps sequentially, you can also jump directly to any step you want. Just download the code from the previous step and make sure that the application runs as intended.

tools/builder/prepare-gh-pages.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,24 +51,11 @@ function getSteps(tutorialDir) {
5151
mkdirSync(join(cwd, "dist"), { recursive: true });
5252

5353
console.log(`👉 Copying root README.md...`);
54-
function rewriteLinks(file, path, tutorialName) {
55-
let permalink;
56-
if (!path) {
57-
permalink = "index.html";
58-
} else if (!tutorialName) {
59-
permalink = `build/${path.replace(".md", ".html")}`;
60-
} else {
61-
permalink = `${tutorialName}/build/${path.replace(".md", ".html")}`;
62-
}
54+
function rewriteLinks(file) {
55+
let permalink = file.split("dist/")[1].replace(".md", ".html");
6356
let content = `---\npermalink: ${permalink}\n---\n\n${readFileSync(file, { encoding: "utf8"})}`;
64-
if (tutorialName) {
65-
content = content.replace(/steps\/(\d{2})/g, `${tutorialName}/build/$1`);
66-
content = content.replace(/\.\.\/(\d{2})/g, "../$1");
67-
} else {
68-
content = content.replace(/steps\/(\d{2})/g, "build/$1");
69-
content = content.replace(/\.\.\/(\d{2})/g, "../$1");
70-
}
7157
content = content.replace(/README\.md/g, "README.html");
58+
content = content.replace(/\.\/packages\//g, "./");
7259
writeFileSync(file, content, { encoding: "utf8" });
7360
}
7461

@@ -104,7 +91,7 @@ function getSteps(tutorialDir) {
10491
console.log(` 👉 Copying tutorial README.md...`);
10592
if (existsSync(join(tutorialDir, "README.md"))) {
10693
copyFileSync(join(tutorialDir, "README.md"), join(distTutorialDir, "index.md"));
107-
rewriteLinks(join(distTutorialDir, "index.md"), null, tutorial);
94+
rewriteLinks(join(distTutorialDir, "index.md"));
10895
}
10996

11097
console.log(` 👉 Zipping TypeScript sources...`);
@@ -132,7 +119,7 @@ function getSteps(tutorialDir) {
132119
const [, path, step] = readme.match("steps/((.*)/README.md)");
133120
mkdirSync(join(buildDir, step), { recursive: true });
134121
copyFileSync(join(tutorialDir, readme), join(buildDir, path));
135-
rewriteLinks(join(buildDir, path), path, tutorial);
122+
rewriteLinks(join(buildDir, path));
136123
});
137124

138125
console.log(` 🌅 Copying step assets...`);

0 commit comments

Comments
 (0)