From 8cf40d5dea28db1719d8becb257b314bcd75aad1 Mon Sep 17 00:00:00 2001 From: BITLIU Date: Thu, 25 Mar 2021 20:50:54 +0800 Subject: [PATCH 1/3] Complete Scripts Description Add 4 new Scripts to README --- scripts/README.md | 71 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/scripts/README.md b/scripts/README.md index e90d65861d..11bb9f4866 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -7,6 +7,10 @@ | `test_examples.sh` | This script tests whether a change affects example files bundled in the website. | | `check-headers-file.sh` | This script checks the headers if you are in a production environment. | | `diff_l10n_branches.py` | This script generates a report of outdated contents in `content/` directory by comparing two l10n team milestone branches. | +| `hash-files.sh` | This script emits as hash for the files listed in $@ | +| `linkchecker.py` | This a link checker for Kubernetes documentation website. | +| `lsync.sh` | This script checks if the English version of a page has changed since a localized page has been committed. | +| `replace-capture.sh` | This script sets K8S_WEBSITE in your env to your docs website root or rely on this script to determine it automatically | @@ -88,3 +92,70 @@ Options: --src-lang TEXT Source language --help Show this message and exit. ``` + +## hash-files.sh + +This script emits as hash for the files listed in $@. + + $ ./scripts/hash-files.sh + +## linkchecker.py + +This a link checker for Kubernetes documentation website. +- We cover the following cases for the language you provide via `-l`, which + defaults to 'en'. +- If the language specified is not English (`en`), we check if you are + actually using the localized links. For example, if you specify `zh` as + the language, and for link target `/docs/foo/bar`, we check if the English + version exists AND if the Chinese version exists as well. A checking record + is produced if the link can use the localized version. + +``` + +Usage: linkchecker.py -h + +Cases handled: + +- [foo](#bar) : ignored currently ++ [foo](http://bar) : insecure links to external site ++ [foo](https://k8s.io/website/...) : hardcoded site domain name + ++ [foo](//docs/bar/...) : where is not 'en' + + //docs/bar : contains shortcode, so ignore, or + + //docs/bar : is a image link (ignore currently), or + + //docs/bar : points to shared (non-localized) page, or + + //docs/bar.md : exists for current lang, or + + //docs/bar/_index.md : exists for current lang, or + + //docs/bar/ : is a redirect entry, or + + //docs/bar : is something we don't understand, then ERR + ++ [foo](/docs/bar/...) + + /docs/bar : contains shortcode, so ignore, or + + /docs/bar : is a image link (ignore currently), or + + /docs/bar : points to a shared (non-localized) page, or + + /docs/bar.md : exists for current lang, or + + /docs/bar/_index.md : exists for current lang, or + + /docs/bar : is a redirect entry, or + + /docs/bar : is something we don't understand + +``` +## lsync.sh + +This script checks if the English version of some localized contents have changed +since a localized version has been committed. + +The following example check a single file: + + ./scripts/lsync.sh content/zh/docs/concepts/_index.md + +The following command checks a subdirectory: + + ./scripts/lsync.sh content/zh/docs/concepts/ + +## replace-capture.sh + +This script sets K8S_WEBSITE in your env to your docs website root or rely on this script to determine it automatically + +You must run the script inside the repository for that to work + + $ ./scripts/replace-capture.sh From 357a1225f6dfc69d30262a5d102212fb7fb0c0b2 Mon Sep 17 00:00:00 2001 From: BITLIU Date: Fri, 26 Mar 2021 09:27:01 +0800 Subject: [PATCH 2/3] Update scripts/README.md Co-authored-by: Tim Bannister --- scripts/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/README.md b/scripts/README.md index 11bb9f4866..08de0d04ff 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -144,7 +144,7 @@ Cases handled: This script checks if the English version of some localized contents have changed since a localized version has been committed. -The following example check a single file: +The following example checks a single file: ./scripts/lsync.sh content/zh/docs/concepts/_index.md From 2eee57c425662a13a476ac154fd4b79b61ef8c86 Mon Sep 17 00:00:00 2001 From: BITLIU Date: Fri, 26 Mar 2021 09:30:33 +0800 Subject: [PATCH 3/3] Complete scripts descriptions add lsync.sh hash-files.sh linkchecker.py description remove replace-capture.sh description --- scripts/README.md | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/scripts/README.md b/scripts/README.md index 08de0d04ff..4f7ee7eec3 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -97,7 +97,7 @@ Options: This script emits as hash for the files listed in $@. - $ ./scripts/hash-files.sh + $ ./scripts/hash-files.sh ## linkchecker.py @@ -146,16 +146,9 @@ since a localized version has been committed. The following example checks a single file: - ./scripts/lsync.sh content/zh/docs/concepts/_index.md + ./scripts/lsync.sh content/zh/docs/concepts/_index.md The following command checks a subdirectory: - ./scripts/lsync.sh content/zh/docs/concepts/ + ./scripts/lsync.sh content/zh/docs/concepts/ -## replace-capture.sh - -This script sets K8S_WEBSITE in your env to your docs website root or rely on this script to determine it automatically - -You must run the script inside the repository for that to work - - $ ./scripts/replace-capture.sh