]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
spellcheck.yml: remove .1/.3 handling, clean all man page .md files
authorDaniel Stenberg <daniel@haxx.se>
Mon, 19 Feb 2024 08:54:21 +0000 (09:54 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 19 Feb 2024 10:41:12 +0000 (11:41 +0100)
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
.github/scripts/cleanspell.pl
.github/scripts/spellcheck.words
.github/workflows/spellcheck.yml

index 5d0fe2b2fbb07698df790a3ddfc16a994380cbd0..fabcce23b9878b5c7e4b017369945ba4667ee81c 100755 (executable)
@@ -47,6 +47,8 @@ while(<F>) {
 }
 close(F);
 
-open(O, ">$f") or die;
-print O @out;
-close(O);
+if(!$ignore) {
+    open(O, ">$f") or die;
+    print O @out;
+    close(O);
+}
index 06648a3f99fd3294c415436d6d40bc1da600c145..9a0d79f588dcfbafa7e615cefd4f59bae13a5e44 100755 (executable)
@@ -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(<F>) {
-    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(<F>) {
         $_ =~ 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);
index 4495454e174f4449961b34ac883a06c9532683c8..1c408f03aa2b411bedaafb61da8c82356e84ecaf 100644 (file)
@@ -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
index a619fcc046980a7be00a217e02687ee2495971f0..e78a36ca7abb8d906ce6ae56a69aa3684ee6e01c 100644 (file)
@@ -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