2010-04-18 14:18:31 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
2021-04-22 16:20:41 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 Ole Tange, http://ole.tange.dk and Free Software and Foundation, Inc.
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
2010-04-18 14:18:31 +00:00
|
|
|
$line="";
|
|
|
|
|
|
|
|
while(<>) {
|
|
|
|
/^\#/ and next;
|
|
|
|
if($verbatim) {
|
|
|
|
if(/^\S/) {
|
|
|
|
chomp($line);
|
|
|
|
$line=~s/\s+$/\n/gism;
|
|
|
|
push(@lines, $line."-verbatim-\n");
|
|
|
|
$verbatim=0;
|
|
|
|
$line="";
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if(/^\s*$/) {
|
|
|
|
$line=~s/B<(.*?)>/*$1*/gs;
|
2010-06-05 23:03:39 +00:00
|
|
|
# =_text_ -> = _text_
|
|
|
|
$line=~s/I<(.*?)>/ _$1_ /gs;
|
2010-04-18 14:18:31 +00:00
|
|
|
push(@lines,$line."\n\n");
|
|
|
|
$line="";
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
if(/^\s+\S/) {
|
|
|
|
$line.="+verbatim+\n ";
|
|
|
|
$verbatim=1;
|
|
|
|
} else {
|
|
|
|
s/\*/***/g;
|
|
|
|
chomp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
s/=head1 (.*)/= $1 =/g;
|
|
|
|
s/=head2 (.*)/== $1 ==/g;
|
|
|
|
s/=over (.*)//g;
|
|
|
|
s/=back//g;
|
|
|
|
s/=item /* /g;
|
|
|
|
m/=cut/ and last;
|
|
|
|
$line.=$_." ";
|
|
|
|
}
|
|
|
|
|
|
|
|
print @lines;
|