summaryrefslogtreecommitdiff
path: root/libexec/makewhatis/makewhatis.pl
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2002-04-02 03:17:17 +0000
committerMarc Espie <espie@cvs.openbsd.org>2002-04-02 03:17:17 +0000
commit96031e25c25b0dd75133bfed22116dbff8e5decc (patch)
treee6174210ab147133cae4a83107dfe2f7c9e15d32 /libexec/makewhatis/makewhatis.pl
parent6f76a49442bffcdbe9199da91a7078837e6c8326 (diff)
A few improvements to accommodate more ports.
- recognize unbreakable em dashes from pod2man, - handle some user-defined font changes, - kill obvious non-subjects. ok millert@
Diffstat (limited to 'libexec/makewhatis/makewhatis.pl')
-rw-r--r--libexec/makewhatis/makewhatis.pl15
1 files changed, 12 insertions, 3 deletions
diff --git a/libexec/makewhatis/makewhatis.pl b/libexec/makewhatis/makewhatis.pl
index d66dba58160..9c69df08204 100644
--- a/libexec/makewhatis/makewhatis.pl
+++ b/libexec/makewhatis/makewhatis.pl
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
# ex:ts=8 sw=4:
-# $OpenBSD: makewhatis.pl,v 1.19 2001/04/03 16:33:49 espie Exp $
+# $OpenBSD: makewhatis.pl,v 1.20 2002/04/02 03:17:16 espie Exp $
#
# Copyright (c) 2000 Marc Espie.
#
@@ -149,6 +149,8 @@ sub add_unformated_subject
{}
# unbreakable spaces
s/\\\s+/ /g;
+ # unbreakable em dashes
+ s/\\\|\\\(em\\\|/-/g;
# em dashes
s/\\\(em\s+/- /g;
# em dashes in the middle of lines
@@ -157,6 +159,7 @@ sub add_unformated_subject
s/\\\(tm/(tm)/g;
# font changes
s/\\f[BIRP]//g;
+ s/\\f\(..//g;
# fine space adjustments
while (s/\\[vh]\'.*?\'//g)
{}
@@ -177,6 +180,12 @@ sub add_unformated_subject
s/\s+$//;
s/^\s+//;
s/\s+/ /g;
+ # some damage control
+ if (m/^\Q($section) - \E/) {
+ print STDERR "Rejecting non-subject line from $filename:\n$_\n"
+ if $picky;
+ return;
+ }
push(@$subjects, $_);
verify_subject($_, $filename) if $picky;
}
@@ -231,11 +240,11 @@ sub handle_unformated
if (m/^\.\s*SH/ || m/^\.\s*sh/) {
my @subject = ();
while (<$f>) {
- last if m/^\.\s*(?:SH|sh|SS|ss|nf)/;
+ last if m/^\.\s*(?:SH|sh|SS|ss|nf|LI)/;
# several subjects in one manpage
if (m/^\.\s*(?:PP|Pp|br|PD|LP|sp)/) {
add_unformated_subject(\@lines, \@subject,
- $section, $filename, \%toexpand)
+ $section, $filename, \%toexpand)
if @subject != 0;
@subject = ();
next;