paper-cutter/{{cookiecutter.paper_repo_name}}/helpers/strip-references.pl
Filip Gralinski 67c788fe69 Init from an internal repo.
Commit d5b6f8e831fc5c933af5ceb1267f51ef6af6c438
2020-11-24 08:33:07 +01:00

29 lines
509 B
Perl
Executable File

#!/usr/bin/perl
use strict;
my @previously_skipped = ();
my $was_reference = 0;
while (my $line=<STDIN>) {
chomp $line;
if ($line =~ /^References$/) {
if ($was_reference) {
for my $pline (@previously_skipped) {
print "$pline\n";
}
@previously_skipped = ();
} else {
$was_reference = 1;
}
}
if ($was_reference) {
push @previously_skipped, $line;
} else {
print "$line\n";
}
}