3 # Copyright (C) 2007-2022 Ole Tange, http://ole.tange.dk and Free
4 # Software Foundation, Inc.
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, see <https://www.gnu.org/licenses/>
18 # or write to the Free Software Foundation, Inc., 51 Franklin St,
19 # Fifth Floor, Boston, MA 02110-1301 USA
21 # SPDX-FileCopyrightText: 2021-2022 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
22 # SPDX-License-Identifier: GPL-3.0-or-later
24 # This fixes problems in pod2rst conversion
40 # Not fixed (RST does not support Bold-Italic):
41 # B<cat | xargs -d "\n" -n1 I<command>>
44 # Emulate a shell pipe but between Perl functions
45 # stdin | func1 | func2 | ... | funcN
46 # pipefunc(*func1, *func2, ..., *funcN);
49 my $pid = open(my $kid_to_read, "-|");
50 defined($pid) || die "can't fork: $!";
52 open STDIN
, "<&", $kid_to_read or die;
57 # More than one function remaining: Recurse
60 # Only one function remaining: Run it
73 s/^=item -/=item \001/;
76 # ignore source blocks
88 # join lines in each paragraph
105 s/^-(\s+)\001/-$1\\-/g;
112 # stdin | pre1() | pre2() | pod2rst() | post()
113 pipefunc
(*pre1
,*pre2
,*pod2rst
,*post
);