Home Explore Blog CI



kubernetes

3rd chunk of `scripts/README.md`
3f8578144618f39cf3cba33bb753cb38141eab772b4636460000000100000d4a
- If the language for the files scanned is not English (`en`), we check if you
  are actually using the localized links. For example, if you specify a filter
  similar to as `content/zh-cn/docs/**/*.md`, 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.
- If the language specified is not English (`en`), a checking record is produced,
  and the `-w` switch is used, the script will perform in-place substitutions
  for links that have the format `/docs` and currently have a localized version
  available. This is an experimental feature and aims to reduce the amount of
  work required to update links to point to localized content. It currently
  works for Markdown files only.
```

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](/<lang>/docs/bar/...)  : where <lang> is not 'en'
  + /<lang>/docs/bar           : contains shortcode, so ignore, or
  + /<lang>/docs/bar           : is a image link (ignore currently), or
  + /<lang>/docs/bar           : points to shared (non-localized) page, or
  + /<lang>/docs/bar.md        : exists for current lang, or
  + /<lang>/docs/bar/_index.md : exists for current lang, or
  + /<lang>/docs/bar/          : is a redirect entry, or
  + /<lang>/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

+ [foo](<lang>/docs/bar/...) : leading slash missing for absolute path

+ [foo](docs/bar/...)        : leading slash missing for absolute path

```
## 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 checks a single file:

    ./scripts/lsync.sh content/zh-cn/docs/concepts/_index.md

The following command checks a subdirectory:

    ./scripts/lsync.sh content/zh-cn/docs/concepts/

## check-ctrlcode.py

This script finds control-code(0x00-0x1f) in text files.
It will display illegal character in browser.

```
Usage: ./check-ctrlcode.py <dir> <ext>

  <dir>    Specify the directory to check.
  <ext>    Specify the extension to check.

For example, we can execute as following.

  ./check-ctrlcode.py ../content/en/ .md

The output is following format.

  "{0} <L{1}:{2}:{3}>: {4}"

  {0} : The path of file that a control-code exists.
  {1} : The line number that a control-code exists.
  {2} : The column number that a control-code exists.
  {3} : The found control-code.
  {4} : The one-line strings in the file.
```

## ja/verify-spelling.sh

This script finds Japanese words that are against the guideline[1]
[1] https://kubernetes.io/ja/docs/contribute/localization/#%E9%A0%BB%E5%87%BA%E5%8D%98%E8%AA%9E

```
Usage: ./ja/verify-spelling.sh
```

Title: Kubernetes Documentation Development Scripts (Continued)
Summary
This section describes more Kubernetes documentation scripts. `linkchecker.py` further explains link checking scenarios, including localized link verification and handling of various URL formats. `lsync.sh` detects changes in the English version of content compared to its localized counterparts. `check-ctrlcode.py` finds control characters in text files. `ja/verify-spelling.sh` identifies Japanese words that violate the project's spelling guidelines.