From 8b1f3aa6087335456b6f16b039b983d14971d4b6 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Mon, 19 Feb 2024 09:54:21 +0100 Subject: [PATCH] spellcheck.yml: remove .1/.3 handling, clean all man page .md files Since we generate all .1 and .3 files from markdown now, we can limit the spellcheck to the markdown versions only. Closes #12960 --- .github/scripts/cleancmd.pl | 8 +++-- .github/scripts/cleanspell.pl | 52 ++++++++++++++++++-------------- .github/scripts/spellcheck.words | 5 ++- .github/workflows/spellcheck.yml | 40 ++++++------------------ 4 files changed, 47 insertions(+), 58 deletions(-) diff --git a/.github/scripts/cleancmd.pl b/.github/scripts/cleancmd.pl index 5d0fe2b2fb..fabcce23b9 100755 --- a/.github/scripts/cleancmd.pl +++ b/.github/scripts/cleancmd.pl @@ -47,6 +47,8 @@ while() { } close(F); -open(O, ">$f") or die; -print O @out; -close(O); +if(!$ignore) { + open(O, ">$f") or die; + print O @out; + close(O); +} diff --git a/.github/scripts/cleanspell.pl b/.github/scripts/cleanspell.pl index 06648a3f99..9a0d79f588 100755 --- a/.github/scripts/cleanspell.pl +++ b/.github/scripts/cleanspell.pl @@ -3,38 +3,31 @@ # # SPDX-License-Identifier: curl # -# Input: a libcurl nroff man page -# Output: the same file, minus the SYNOPSIS and the EXAMPLE sections +# Given: a libcurl curldown man page +# Outputs: the same file, minus the SYNOPSIS and the EXAMPLE sections # my $f = $ARGV[0]; -my $o = $ARGV[1]; open(F, "<$f") or die; -open(O, ">$o") or die; +my @out; my $ignore = 0; while() { - if($_ =~ /^.SH (SYNOPSIS|EXAMPLE|\"SEE ALSO\"|SEE ALSO)/) { + if($_ =~ /^# (SYNOPSIS|EXAMPLE)/) { $ignore = 1; } - elsif($ignore && ($_ =~ /^.SH/)) { + elsif($ignore && ($_ =~ /^# [A-Z]/)) { $ignore = 0; } elsif(!$ignore) { - # filter out mentioned CURLE_ names + # **bold** + $_ =~ s/\*\*(\S.*?)\*\*//g; + # *italics* + $_ =~ s/\*(\S.*?)\*//g; + $_ =~ s/CURL(M|SH|U|H)code//g; - $_ =~ s/CURL_(READ|WRITE)FUNC_[A-Z0-9_]*//g; - $_ =~ s/CURL_CSELECT_[A-Z0-9_]*//g; - $_ =~ s/CURL_DISABLE_[A-Z0-9_]*//g; - $_ =~ s/CURL_FORMADD_[A-Z0-9_]*//g; - $_ =~ s/CURL_HET_DEFAULT//g; - $_ =~ s/CURL_IPRESOLVE_[A-Z0-9_]*//g; - $_ =~ s/CURL_PROGRESSFUNC_CONTINUE//g; - $_ =~ s/CURL_REDIR_[A-Z0-9_]*//g; - $_ =~ s/CURL_RTSPREQ_[A-Z0-9_]*//g; - $_ =~ s/CURL_TIMECOND_[A-Z0-9_]*//g; - $_ =~ s/CURL_VERSION_[A-Z0-9_]*//g; + $_ =~ s/CURL_[A-Z0-9_]*//g; $_ =~ s/CURLALTSVC_[A-Z0-9_]*//g; $_ =~ s/CURLAUTH_[A-Z0-9_]*//g; $_ =~ s/CURLE_[A-Z0-9_]*//g; @@ -56,25 +49,38 @@ while() { $_ =~ s/CURLPX_[A-Z0-9_]*//g; $_ =~ s/CURLSHE_[A-Z0-9_]*//g; $_ =~ s/CURLSHOPT_[A-Z0-9_]*//g; + $_ =~ s/CURLSSLOPT_[A-Z0-9_]*//g; $_ =~ s/CURLSSH_[A-Z0-9_]*//g; $_ =~ s/CURLSSLBACKEND_[A-Z0-9_]*//g; $_ =~ s/CURLU_[A-Z0-9_]*//g; + $_ =~ s/CURLUPART_[A-Z0-9_]*//g; + #$_ =~ s/\bCURLU\b//g; # stand-alone CURLU $_ =~ s/CURLUE_[A-Z0-9_]*//g; + $_ =~ s/CURLHE_[A-Z0-9_]*//g; + $_ =~ s/CURLWS_[A-Z0-9_]*//g; + $_ =~ s/CURLKH[A-Z0-9_]*//g; $_ =~ s/CURLUPART_[A-Z0-9_]*//g; $_ =~ s/CURLUSESSL_[A-Z0-9_]*//g; - $_ =~ s/curl_global_(init_mem|sslset|cleanup)//g; + $_ =~ s/CURLPAUSE_[A-Z0-9_]*//g; + $_ =~ s/CURLHSTS_[A-Z0-9_]*//g; + $_ =~ s/curl_global_([a-z_]*)//g; $_ =~ s/curl_(strequal|strnequal|formadd|waitfd|formget|getdate|formfree)//g; - $_ =~ s/curl_easy_(nextheader|duphandle)//g; - $_ =~ s/curl_multi_fdset//g; + $_ =~ s/curl_easy_([a-z]*)//g; + $_ =~ s/curl_multi_([a-z_]*)//g; $_ =~ s/curl_mime_(subparts|addpart|filedata|data_cb)//g; $_ =~ s/curl_ws_(send|recv|meta)//g; $_ =~ s/curl_url_(dup)//g; $_ =~ s/curl_pushheader_by(name|num)//g; $_ =~ s/libcurl-(env|ws)//g; $_ =~ s/libcurl\\-(env|ws)//g; - $_ =~ s/(^|\W)((tftp|https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=]+)//gi; - print O $_; + $_ =~ s/(^|\W)((tftp|https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=\\]+)//gi; + push @out, $_; } } close(F); + +open(O, ">$f") or die; +for my $l (@out) { + print O $l; +} close(O); diff --git a/.github/scripts/spellcheck.words b/.github/scripts/spellcheck.words index 4495454e17..1c408f03aa 100644 --- a/.github/scripts/spellcheck.words +++ b/.github/scripts/spellcheck.words @@ -39,6 +39,7 @@ auth autobuild autobuilds Autoconf +autoconf Automake Autotools autotools @@ -111,8 +112,8 @@ clientp cliget closesocket CMake -CMake's cmake +CMake's cmake's CMakeLists CodeQL @@ -283,6 +284,7 @@ GPL GPLed Greear groff +gsasl GSKit gskit GSS @@ -795,6 +797,7 @@ Tekniska testability TFTP tftp +threadsafe Tizen TLS tlsv diff --git a/.github/workflows/spellcheck.yml b/.github/workflows/spellcheck.yml index a619fcc046..e78a36ca7a 100644 --- a/.github/workflows/spellcheck.yml +++ b/.github/workflows/spellcheck.yml @@ -9,21 +9,17 @@ on: - master paths: - '**.md' - - '**.3' - - '**.1' - '**/spellcheck.yml' - '**/spellcheck.yaml' - - '**/wordlist.txt' + - '.github/scripts/*' pull_request: branches: - master paths: - '**.md' - - '**.3' - - '**.1' - '**/spellcheck.yml' - '**/spellcheck.yaml' - - '**/wordlist.txt' + - '.github/scripts/*' permissions: {} @@ -33,34 +29,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: install pandoc - run: sudo apt-get install pandoc + - name: trim all man page *.md files + run: find docs -name "*.md" ! -name "_*" | xargs -n1 ./.github/scripts/cleancmd.pl - - name: build curl.1 - run: | - autoreconf -fi - ./configure --without-ssl --without-libpsl - make -C docs + - name: trim libcurl man page *.md files + run: find docs/libcurl -name "curl_*.md" -o -name "libcurl*.md" | xargs -n1 ./.github/scripts/cleanspell.pl - - name: strip "uncheckable" sections from .3 pages - run: find docs -name "*.3" -size +40c | sed 's/\.3//' | xargs -t -n1 -I OO ./.github/scripts/cleanspell.pl OO.3 OO.33 + - name: trim libcurl option man page *.md files + run: find docs/libcurl/opts -name "CURL*.md" | xargs -n1 ./.github/scripts/cleanspell.pl - - name: convert .3 man pages to markdown - run: find docs -name "*.33" -size +40c | sed 's/\.33//' | xargs -t -n1 -I OO pandoc -f man -t markdown OO.33 -o OO.md - - - name: convert .1 man pages to markdown - run: find docs -name "*.1" -size +40c | sed 's/\.1//' | xargs -t -n1 -I OO pandoc OO.1 -o OO.md - - - name: trim the curl.1 markdown file - run: | - perl -pi -e 's/^ .*//' docs/curl.md - perl -pi -e 's/\-\-[\a-z0-9-]*//ig' docs/curl.md - perl -pi -e 's!https://[a-z0-9%/.-]*!!ig' docs/curl.md - - - name: trim the cmdline docs markdown files - run: find docs/cmdline-opts -name "*.md" ! -name "_*" ! -name MANPAGE.md | xargs -n1 ./.github/scripts/cleancmd.pl - - - name: trim the cmdline docs markdown _*.md files + - name: trim cmdline docs markdown _*.md files run: find docs/cmdline-opts -name "_*.md" | xargs -n1 ./.github/scripts/cleancmd.pl --no-header - name: setup the custom wordlist