You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add in-place substitution option for linkchecker.py (#41983)
* Add in-place replacement option for linkchecker.py
Add a new flag '-w' to enable an experimental in-place replacement for Markdown
links only.
* Apply suggestions from code review
Use formatted string literals instead of simple concatenation.
Co-authored-by: Matt Boersma <[email protected]>
* Remove other paths that should not be changed.
* Add more logic to remove paths that start with http or paths that are already linking to the localized page (i.e. start with '/<language-code>').
* Apply suggestions from code review
Simplify expressions.
Co-authored-by: Matt Boersma <[email protected]>
* Avoid updating pages in English.
* Fix syntax error in set comprehension
* Expand on documentation for new -w flag
* Update documentation for linkchecker.py in README
* Add a blurb with information about the new -w
switch that describes what it does and what is
the purpose of adding this behaviour change.
* Update the previously existing description to
match the currently available script flags.
---------
Co-authored-by: Matt Boersma <[email protected]>
Copy file name to clipboardExpand all lines: scripts/README.md
+17-14Lines changed: 17 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,12 +7,12 @@
7
7
|`test_examples.sh`| This script tests whether a change affects example files bundled in the website. |
8
8
|`check-headers-file.sh`| This script checks the headers if you are in a production environment. |
9
9
|`diff_l10n_branches.py`| This script generates a report of outdated contents in `content/<l10n-lang>` directory by comparing two l10n team milestone branches. |
10
-
|`hash-files.sh`| This script emits as hash for the files listed in $@ |
11
-
|`linkchecker.py`| This a link checker for Kubernetes documentation website. |
12
-
|`lsync.sh`| This script checks if the English version of a page has changed since a localized page has been committed. |
13
-
|`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 |
14
-
|`check-ctrlcode.py`| This script finds control-code(0x00-0x1f) in text files. |
15
-
|`ja/verify-spelling.sh`| This script finds Japanese words that are against the guideline. |
10
+
|`hash-files.sh`| This script emits as hash for the files listed in $@|
11
+
|`linkchecker.py`| This a link checker for Kubernetes documentation website.|
12
+
|`lsync.sh`| This script checks if the English version of a page has changed since a localized page has been committed.|
13
+
|`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|
14
+
|`check-ctrlcode.py`| This script finds control-code(0x00-0x1f) in text files.|
15
+
|`ja/verify-spelling.sh`| This script finds Japanese words that are against the guideline. |
16
16
17
17
18
18
@@ -104,14 +104,17 @@ This script emits as hash for the files listed in $@.
104
104
## linkchecker.py
105
105
106
106
This a link checker for Kubernetes documentation website.
107
-
- We cover the following cases for the language you provide via `-l`, which
108
-
defaults to 'en'.
109
-
- If the language specified is not English (`en`), we check if you are
110
-
actually using the localized links. For example, if you specify `zh` as
111
-
the language, and for link target `/docs/foo/bar`, we check if the English
112
-
version exists AND if the Chinese version exists as well. A checking record
113
-
is produced if the link can use the localized version.
114
-
107
+
- If the language for the files scanned is not English (`en`), we check if you
108
+
are actually using the localized links. For example, if you specify a filter
109
+
similar to as `content/zh-cn/docs/**/*.md`, we check if the English version
110
+
exists AND if the Chinese version exists as well. A checking record is
111
+
produced if the link can use the localized version.
112
+
- If the language specified is not English (`en`), a checking record is produced,
113
+
and the `-w` switch is used, the script will perform in-place substitutions
114
+
for links that have the format `/docs` and currently have a localized version
115
+
available. This is an experimental feature and aims to reduce the amount of
116
+
work required to update links to point to localized content. It currently
0 commit comments