comment long regexp in usage preparation
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 13 Mar 2021 06:08:09 +0000 (07:08 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 18 Apr 2022 09:04:29 +0000 (11:04 +0200)
Insert whitespace and comments for readability.

barcat

diff --git a/barcat b/barcat
index d4a8274f6c9af8015332215138b8d46c3158a30d..319bc32826a65d60844f21a872dbefd2a8bef32e 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -81,7 +81,10 @@ GetOptions(\%opt,
                local $/ = undef;  # slurp
                my $pod = readline *DATA;
                $pod =~ s/^=over\K/ 25/;  # indent options list
-               $pod =~ s/^=item\ \N*\n\n\N*\n\K (?:(?:^=over.*?^=back\n)?(?!=)\N*\n)*/\n/g;
+               $pod =~ s{
+                       ^=item \h \N*\n\n \N*\n \K  # first line
+                       (?: (?: ^=over .*? ^=back\n )? (?!=) \N*\n )*
+               }{\n}g;  # abbreviate options
                $pod =~ s/[.,](?=\n)//g;  # trailing punctuation
                $pod =~ s/^=item\ \K(?=--)/____/g;  # align long options
                # abbreviate <variable> indicators