/
githubmirror
/
curl
Обзор
Документация
Войти
/
githubmirror
/
curl
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
.github/scripts/trimmarkdownheader.pl
44 строки
788 B
Viktor Szakats
tidy-up: fix Perl syntax and formatting nits
23 июл 2026, 13:56
23 июл 2026, 13:56
0ada203
Код
Авторство
О чём код?
#!/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 # use strict; use warnings; 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);