From b3c07de0f223436fb177c0ee5018014c3db51219 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:11:55 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/peterdemin/pip-compile-multi: v2.4.1 → v3.2.2](https://github.com/peterdemin/pip-compile-multi/compare/v2.4.1...v3.2.2) - [github.com/lovesegfault/beautysh: v6.1.0 → v6.4.2](https://github.com/lovesegfault/beautysh/compare/v6.1.0...v6.4.2) - [github.com/pre-commit/pygrep-hooks: v1.9.0 → v1.10.0](https://github.com/pre-commit/pygrep-hooks/compare/v1.9.0...v1.10.0) - [github.com/PyCQA/isort: 5.8.0 → 7.0.0](https://github.com/PyCQA/isort/compare/5.8.0...7.0.0) - [github.com/pre-commit/pre-commit-hooks: v3.4.0 → v6.0.0](https://github.com/pre-commit/pre-commit-hooks/compare/v3.4.0...v6.0.0) - [github.com/jumanjihouse/pre-commit-hooks: 2.1.5 → 3.0.0](https://github.com/jumanjihouse/pre-commit-hooks/compare/2.1.5...3.0.0) - [github.com/codespell-project/codespell: v2.0.0 → v2.4.1](https://github.com/codespell-project/codespell/compare/v2.0.0...v2.4.1) --- .pre-commit-config.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a9f5a8c0dd8..54032cabae0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,30 +3,30 @@ --- # See https://pre-commit.com for more information # See https://pre-commit.com/hooks.html for more hooks -default_stages: [commit, push] +default_stages: [pre-commit, pre-push] default_language_version: # force all unspecified Python hooks to run python3 python: python3 minimum_pre_commit_version: '1.20.0' repos: - repo: https://github.com/peterdemin/pip-compile-multi - rev: v2.4.1 + rev: v3.2.2 hooks: - id: pip-compile-multi-verify - repo: https://github.com/lovesegfault/beautysh - rev: v6.1.0 + rev: v6.4.2 hooks: - id: beautysh args: [-i, '2'] - repo: https://github.com/pre-commit/pygrep-hooks - rev: v1.9.0 + rev: v1.10.0 hooks: - id: python-use-type-annotations - repo: https://github.com/PyCQA/isort - rev: 5.8.0 + rev: 7.0.0 hooks: - id: isort args: [--profile=black, -l=99] @@ -37,7 +37,7 @@ repos: - id: check-hooks-apply - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.4.0 + rev: v6.0.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -58,13 +58,13 @@ repos: # - id: remove-tabs - repo: https://github.com/jumanjihouse/pre-commit-hooks - rev: 2.1.5 + rev: 3.0.0 hooks: - id: shellcheck # - id: shfmt - repo: https://github.com/codespell-project/codespell - rev: v2.0.0 + rev: v2.4.1 hooks: - id: codespell name: Run codespell From 1c5ee9fdfb3d528d53a5634c27d6bd8e78f6cb7b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:12:20 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/CONTRIBUTORS.svg | 2 +- gh-md-toc | 192 +++++++++++++++++++-------------------- scripts/check_grammar.sh | 4 +- 3 files changed, 99 insertions(+), 99 deletions(-) diff --git a/.github/CONTRIBUTORS.svg b/.github/CONTRIBUTORS.svg index 3d26782b831..bd27f9d7bb7 100644 --- a/.github/CONTRIBUTORS.svg +++ b/.github/CONTRIBUTORS.svg @@ -6,4 +6,4 @@ - \ No newline at end of file + diff --git a/gh-md-toc b/gh-md-toc index 7c6d2d6ba97..9d08663b763 100755 --- a/gh-md-toc +++ b/gh-md-toc @@ -216,49 +216,49 @@ gh_toc_grab() { } print sprintf("%*s", level*3, " ") "* [" text "](" gh_url modified_href ")" ' - if [ `uname -s` == "OS/390" ]; then - grepcmd="pcregrep -o" - echoargs="" - awkscript='{ + if [ `uname -s` == "OS/390" ]; then + grepcmd="pcregrep -o" + echoargs="" + awkscript='{ level = substr($0, length($0), 1) text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5) href = substr($0, match($0, "href=\"([^\"]+)?\"")+6, RLENGTH-7) '"$common_awk_script"' }' -else - grepcmd="grep -Eo" - echoargs="-e" - awkscript='{ + else + grepcmd="grep -Eo" + echoargs="-e" + awkscript='{ level = substr($0, length($0), 1) text = substr($0, match($0, /a>.*<\/h/)+2, RLENGTH-5) href = substr($0, match($0, "href=\"[^\"]+?\"")+6, RLENGTH-7) '"$common_awk_script"' }' -fi -href_regex='href=\"[^\"]+?\"' - -# if closed is on the new line, then move it on the prev line -# for example: -# was: The command foo1 -# -# became: The command foo1 -sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | - -# find strings that corresponds to template -$grepcmd '//g' | sed 's/<\/code>//g' | - -# remove g-emoji -sed 's/]*[^<]*<\/g-emoji> //g' | - -# now all rows are like: -# ... is on the new line, then move it on the prev line + # for example: + # was: The command foo1 + # + # became: The command foo1 + sed -e ':a' -e 'N' -e '$!ba' -e 's/\n<\/h/<\/h/g' | + + # find strings that corresponds to template + $grepcmd '//g' | sed 's/<\/code>//g' | + + # remove g-emoji + sed 's/]*[^<]*<\/g-emoji> //g' | + + # now all rows are like: + # ... / placeholders" - echo " $app_name - Create TOC for markdown from STDIN" - echo " $app_name --help Show help" - echo " $app_name --version Show version" - return -fi - -if [ "$1" = '--version' ]; then - echo "$gh_toc_version" - echo - echo "os: `lsb_release -d | cut -f 2`" - echo "kernel: `cat /proc/version`" - echo "shell: `$SHELL --version`" - echo - for tool in curl wget grep awk sed; do - printf "%-5s: " $tool - echo `$tool --version | head -n 1` - done - return -fi - -if [ "$1" = "-" ]; then - if [ -z "$TMPDIR" ]; then - TMPDIR="/tmp" - elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then - mkdir -p "$TMPDIR" + if [ "$1" = '--help' ] || [ $# -eq 0 ] ; then + local app_name=$(basename "$0") + echo "GitHub TOC generator ($app_name): $gh_toc_version" + echo "" + echo "Usage:" + echo " $app_name [--insert] src [src] Create TOC for a README file (url or local path)" + echo " $app_name [--no-backup] src [src] Create TOC without backup, requires / placeholders" + echo " $app_name - Create TOC for markdown from STDIN" + echo " $app_name --help Show help" + echo " $app_name --version Show version" + return fi - local gh_tmp_md - if [ `uname -s` == "OS/390" ]; then - local timestamp=$(date +%m%d%Y%H%M%S) - gh_tmp_md="$TMPDIR/tmp.$timestamp" - else - gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) + + if [ "$1" = '--version' ]; then + echo "$gh_toc_version" + echo + echo "os: `lsb_release -d | cut -f 2`" + echo "kernel: `cat /proc/version`" + echo "shell: `$SHELL --version`" + echo + for tool in curl wget grep awk sed; do + printf "%-5s: " $tool + echo `$tool --version | head -n 1` + done + return + fi + + if [ "$1" = "-" ]; then + if [ -z "$TMPDIR" ]; then + TMPDIR="/tmp" + elif [ -n "$TMPDIR" -a ! -d "$TMPDIR" ]; then + mkdir -p "$TMPDIR" + fi + local gh_tmp_md + if [ `uname -s` == "OS/390" ]; then + local timestamp=$(date +%m%d%Y%H%M%S) + gh_tmp_md="$TMPDIR/tmp.$timestamp" + else + gh_tmp_md=$(mktemp $TMPDIR/tmp.XXXXXX) + fi + while read input; do + echo "$input" >> "$gh_tmp_md" + done + gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" + return + fi + + if [ "$1" = '--insert' ]; then + need_replace="yes" + shift fi - while read input; do - echo "$input" >> "$gh_tmp_md" + + if [ "$1" = '--no-backup' ]; then + need_replace="yes" + no_backup="yes" + shift + fi + for md in "$@" + do + echo "" + gh_toc "$md" "$#" "$need_replace" "$no_backup" done - gh_toc_md2html "$gh_tmp_md" | gh_toc_grab "" - return -fi - -if [ "$1" = '--insert' ]; then - need_replace="yes" - shift -fi - -if [ "$1" = '--no-backup' ]; then - need_replace="yes" - no_backup="yes" - shift -fi -for md in "$@" -do - echo "" - gh_toc "$md" "$#" "$need_replace" "$no_backup" -done -echo "" -echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" + echo "" + echo "Created by [gh-md-toc](https://github.com/ekalinin/github-markdown-toc)" } # diff --git a/scripts/check_grammar.sh b/scripts/check_grammar.sh index 7878de29b6a..6bc9d3c4cab 100644 --- a/scripts/check_grammar.sh +++ b/scripts/check_grammar.sh @@ -65,5 +65,5 @@ find ./docs -type f -exec strings {} \; | tr ' ' '\n' >> "${DATAFILE}" aspell --lang=en --ignore-case --personal=./scripts/template/words-to-ignore.en.pws check "${DATAFILE_SORTED}" - if [ -f "${DATAFILE}" ]; then rm "${DATAFILE}"; fi - if [ -f "${DATAFILE_SORTED}" ]; then rm "${DATAFILE_SORTED}"; fi +if [ -f "${DATAFILE}" ]; then rm "${DATAFILE}"; fi +if [ -f "${DATAFILE_SORTED}" ]; then rm "${DATAFILE_SORTED}"; fi