mirror of
https://github.com/curl/curl.git
synced 2026-05-05 22:47:29 +03:00
GHA: trim markdown headers before proselinting
Allow interface.md to use more exclamation marks. Closes #14645
This commit is contained in:
parent
23749bfd04
commit
c8c64c882c
2 changed files with 46 additions and 2 deletions
41
.github/scripts/trimmarkdownheader.pl
vendored
Executable file
41
.github/scripts/trimmarkdownheader.pl
vendored
Executable file
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env perl
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
# Given: a libcurl curldown man page
|
||||
# Outputs: the same file, minus the header
|
||||
#
|
||||
|
||||
my $f = $ARGV[0];
|
||||
|
||||
open(F, "<$f") or die;
|
||||
|
||||
my @out;
|
||||
my $line = 0;
|
||||
my $hideheader = 0;
|
||||
|
||||
while(<F>) {
|
||||
if($hideheader) {
|
||||
if(/^---/) {
|
||||
# end if hiding
|
||||
$hideheader = 0;
|
||||
}
|
||||
push @out, "\n"; # replace with blank
|
||||
next;
|
||||
}
|
||||
elsif(!$line++ && /^---/) {
|
||||
# starts with a header, strip off the header
|
||||
$hideheader = 1;
|
||||
push @out, "\n"; # replace with blank
|
||||
next;
|
||||
}
|
||||
push @out, $_;
|
||||
}
|
||||
close(F);
|
||||
|
||||
open(O, ">$f") or die;
|
||||
for my $l (@out) {
|
||||
print O $l;
|
||||
}
|
||||
close(O);
|
||||
Loading…
Add table
Add a link
Reference in a new issue