Improved the build rules for rsync.1 and rsyncd.conf.5 when building
[rsync/qnx.git] / tweak_manpage
blobf10d2a05e44ce29e7a509f25f00e6d59f18fbdd2
1 #!/usr/bin/perl -i -p
3 # Make some hyphens unbreakable.
4 s{(--\w[-\w]+)}{ $x = $1; $x =~ s/-/\\-/g; $x }eg;
5 s/(?<!\\)-(['"\d*])/\\-$1/g;
6 s#(['"(= /,])-(?!-)#$1\\-#g;
7 s/(\\fB)-/$1\\-/g;
8 s/(\[\w)-(\w\])/$1\\-$2/g;
9 s{(\\f\(CW.*?\\fP)}{ $x = $1; $x =~ s/(?<!\\)-/\\-/g; $x }eg;
10 s/(\.\w+)-/$1\\-/g;
12 # We only need to use "\&'" or "\&." at the start of a line.
13 s/(?<=.)\\\&(['.])/$1$2/g;
15 # Use an em-dash where appropriate.
16 s/ \\?-{1,2} / \\(em /g;
18 # Some quotes turn into open/close quotes.
19 s/'(.)'/\\(oq$1\\(cq/g;
20 s/(^|[ (])"(?!( |$))/$1\\(lq/gm;
21 s/(?<! )"([.,:;! )]|$)/\\(rq$1/gm;
22 s/(\\\(lq[^(]*) "( |$)/$1 \\(rq$2/gm;
23 s/(^| )" ([^(]*\\\(rq)/$1\\(lq $2/gm;
25 # And some don't.
26 s/^([. ])(.*)/ $1 . realquotes($2) /egm;
27 s/(\\f(B|\(CW).*?\\fP)/ realquotes($1) /egs;
29 s/^\\\&(\\\(oq)/$1/gm;
31 sub realquotes
33 my($txt) = @_;
34 $txt =~ s/\\\([lr]q/"/g;
35 $txt =~ s/\\\([oc]q/'/g;
36 $txt;