File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / rsync / tweak_manpage
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Fri Feb 17 15:09:30 2012 UTC (12 years, 4 months ago) by misho
Branches: rsync, MAIN
CVS tags: v3_1_2p5, rsync3_0_9p0, RSYNC3_1_0, RSYNC3_0_9, HEAD
rsync

    1: #!/usr/bin/perl -i -p
    2: 
    3: use strict;
    4: use warnings;
    5: 
    6: # We only need to use "\&'" or "\&." at the start of a line.
    7: s/(?<=.)\\\&(['.])/$1/g;
    8: 
    9: # Some quotes turn into open/close quotes.
   10: s/'(.)'/\\(oq$1\\(cq/g;
   11: s/(^|[ (])"(?!( |$))/$1\\(lq/gm;
   12: s/(?<! )"([.,:;! )]|$)/\\(rq$1/gm;
   13: s/(\\\(lq[^(]*) "( |$)/$1 \\(rq$2/gm;
   14: s/(^| )" ([^(]*\\\(rq)/$1\\(lq $2/gm;
   15: 
   16: # And some don't.
   17: s/^([. ])(.*)/ $1 . realquotes($2) /egm;
   18: s/(\\f(B|\(CW).*?\\fP)/ realquotes($1) /egs;
   19: 
   20: s/^\\\&(\\\(oq)/$1/gm;
   21: 
   22: sub realquotes
   23: {
   24:     my($txt) = @_;
   25:     $txt =~ s/\\\([lr]q/"/g;
   26:     $txt =~ s/\\\([oc]q/'/g;
   27:     $txt;
   28: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>