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
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);
|
||||||
7
.github/workflows/proselint.yml
vendored
7
.github/workflows/proselint.yml
vendored
@ -50,8 +50,11 @@ jobs:
|
|||||||
}
|
}
|
||||||
JSON
|
JSON
|
||||||
|
|
||||||
|
- name: trim headers off all *.md files
|
||||||
|
run: git ls-files '*.md' | xargs -n1 ./.github/scripts/trimmarkdownheader.pl
|
||||||
|
|
||||||
- name: check prose
|
- name: check prose
|
||||||
run: git ls-files '*.md' | grep -Ev 'CHECKSRC.md|DISTROS.md|CURLOPT_INTERFACE.md' | xargs proselint README
|
run: git ls-files '*.md' | grep -Ev 'CHECKSRC.md|DISTROS.md|CURLOPT_INTERFACE.md|interface.md' | xargs proselint README
|
||||||
|
|
||||||
# This is for CHECKSRC and files with aggressive exclamation mark needs
|
# This is for CHECKSRC and files with aggressive exclamation mark needs
|
||||||
- name: create second proselint config
|
- name: create second proselint config
|
||||||
@ -68,4 +71,4 @@ jobs:
|
|||||||
JSON
|
JSON
|
||||||
|
|
||||||
- name: check special prose
|
- name: check special prose
|
||||||
run: proselint docs/CHECKSRC.md docs/libcurl/opts/CURLOPT_INTERFACE.md
|
run: proselint docs/CHECKSRC.md docs/libcurl/opts/CURLOPT_INTERFACE.md docs/cmdline-opts/interface.md
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user