Skip to content

Commit 0bc6a4f

Browse files
committed
fix site script
1 parent cecb3f7 commit 0bc6a4f

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: "@ota-meshi/eslint-plugin-svelte"
66

77
`@ota-meshi/eslint-plugin-svelte` is ESLint plugin for Svelte.
88
It provides many unique check rules by using the template AST.
9-
You can check on the [Online DEMO](./playground/.md).
9+
You can check on the [Online DEMO](./playground.md).
1010

1111
::: **_WORKS IN PROGRESS_** :::
1212

docs/playground.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ hiddenMenu: true
77

88
<ESLintPlayground>
99

10-
The playground is [here](https://ota-meshi.github.io/eslint-plugin-svelte/README)!!
10+
The playground is [here](https://ota-meshi.github.io/eslint-plugin-svelte/playground/)!!
1111

1212
</ESLintPlayground>

tools/update-readme.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,17 +38,24 @@ ${newReadme
3838
)
3939
.replace(/<!--DOCS_IGNORE_START-->[\s\S]*?<!--DOCS_IGNORE_END-->/gu, "")
4040
.replace(
41-
// eslint-disable-next-line regexp/no-super-linear-backtracking -- ignore
42-
/\(https:\/\/ota-meshi.github.io\/eslint-plugin-svelte(.*?)([^/]*\.html)?\)/gu,
43-
(_ptn, c1: string, c2: string) => {
44-
let result = `(.${c1}`
45-
if (c2) {
41+
/\(https:\/\/ota-meshi.github.io\/eslint-plugin-svelte(.*?)\)/gu,
42+
(_ptn, path: string) => {
43+
const [hash] = /(?:#.*)?$/u.exec(path)!
44+
const pathWithoutHash = hash ? path.slice(0, -hash.length) : path
45+
const normalizePathWithoutHash = pathWithoutHash.replace(/\/$/u, "")
46+
const [file] = /[^/]+$/u.exec(normalizePathWithoutHash)!
47+
const pathWithoutFile = file
48+
? normalizePathWithoutHash.slice(0, -file.length)
49+
: normalizePathWithoutHash
50+
51+
let result = `(.${pathWithoutFile}`
52+
if (file.endsWith(".html")) {
4653
result +=
47-
c2 === "index.html" ? "README.md" : c2.replace(/\.html$/, ".md")
54+
file === "index.html" ? "README.md" : file.replace(/\.html$/, ".md")
4855
} else {
49-
result += ".md"
56+
result += `${file}.md`
5057
}
51-
result += ")"
58+
result += `${hash})`
5259
return result
5360
},
5461
)

0 commit comments

Comments
 (0)