diff options
Diffstat (limited to 'rf')
-rwxr-xr-x | rf | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -6,9 +6,9 @@ use warnings; # Default configuration my %fmt; +$fmt{e} = '%a (%y). {\fI%t\fR}. {\*Q%q\*U}. %n, %d. %c: %p. {Available: %w.}'; $fmt{f} = "\n(%A %y)"; $fmt{x} = "\n(%y)"; -$fmt{d} = '%a (%y). {\fI%t\fR}. {\*Q%q\*U}. %n, %d. %c: %p. {Available: %w.}'; # Internal variables @@ -20,8 +20,8 @@ my @refs; while (<>) { chomp; - # Format - if (/^\.F([fdx])(\\?) +(.*)/) { + # Format specification + if (/^\.F([efx])(\\?) +(.*)/) { my ($type, $join, $rest) = ($1, $2, $3); $rest = "\n$rest" if not $join; while (not eof()) { @@ -47,7 +47,7 @@ for (my $i = $#lines; $i >= 0; $i--) { $_ = $lines[$i]; chomp; - # Definition + # Entry definition if (/^\.R([acdnpqtwy]) +(.*)/) { my ($fld, $rest) = ($1, $2); @@ -62,7 +62,7 @@ for (my $i = $#lines; $i >= 0; $i--) { next; } elsif ($refblock) { # print formatted reference definition - push @r, fmt($fmt{d}, $refi) . "\n"; + push @r, fmt($fmt{e}, $refi) . "\n"; } # Inline reference @@ -177,9 +177,7 @@ sub fmt { $fmt =~ s/[.([]?%\Q$fld\E[.,?!:;\])]?//g; } } - $fmt =~ s/ +/ /g; - #$fmt =~ s/([(]) +/$1/; - #$fmt =~ s/ +([.,)])/$1/; + $fmt =~ s/([^.]) +/$1 /g; $fmt =~ s/^ *//; $fmt =~ s/ *$//; return $fmt; |