File: filter.pl

package info (click to toggle)
gmap 2019-01-24-1
  • links: PTS, VCS
  • area: non-free
  • in suites: buster
  • size: 30,600 kB
  • sloc: ansic: 474,114; perl: 6,114; sh: 4,261; makefile: 926
file content (45 lines) | stat: -rwxr-xr-x 1,856 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl
# filter of help2man output
use strict;
use warnings;

while ( <STDIN> ) {
    #multiline regex
    undef $/;
    # remove colon from the name
    s/(^\.SH\sDESCRIPTION\n.*\.IP\n)(cat)/$2/gmxs;
    s/(^\.PP\n)(Input\soptions.*)/.SH OPTIONS\n.SS $2/gmxs;
    s/(^Batch\smode\s\(default\s=\s2\)\n)(Mode.*)/$1\n         $2/gmxs;
    s/(^\.TP\n)(0)(\n)(see\snote.*)/           $2      $4/gmxs;
    s/(^\.TP\n)(1)(\n)(see\snote.*)/           $2      $4/gmxs;
    s/(^\.TP\n)(\(default\))(\n)(2\s{6}see\snote.*)/ $2 $4/gmxs;
    s/(^3\s{6}see\snote.*)/           $1/gmxs;
    s/(^4\s{6}see\snote.*)/           $1/gmxs;
    s/(^5\s{6}expand\s.*)/           $1/gmxs;
    # lineup "-f format" option of gmap
    s/(under\sOutput\stypes\)\:\n)(.*)\.PP\n/
                my $q = $1;
                my $p = $2;
                $p =~ s"(\,\n)"$1 "gmxs;
                $p = $q.' '.$p;
                /egmsx;
    #gsnap aligning
    s/(^\.TP\n)(\(default\))(\n\s+)(4\s{6}see\snote.*)/ $2 $4/gmxs;
    s/(^\.TP\n)(2)(\n)(see\snote.*)/           $2      $4/gmxs;
    s/(^\.TP\n)(3)(\n)(see\snote.*)/           $2      $4/gmxs;
    s/(^5\s{6}see\snote\s.*)/           $1/gmxs;
    s/(^Examples:\n\.TP)/\.TP\n$1/gmsx;
    s/(.*be\schanged)\n\.TP\n(by\sproviding.*)/$1 $2/gmsx;
    #gmap aligning
    #fix gmap_build header
    #s/(^Batch\smode\s\(default\s=\s2\)\n)(Mode.*)/$1\n         $2/gmxs;
    s/(^\.TP\n)(0)(\n)(mmap\s.*)/           $2      $4/gmxs;
    s/(^\.TP\n)(1)(\n)(mmap\s.*)/           $2      $4/gmxs;
    s/(^\.TP\n)(\(default\))(\n)(2\s{6}mmap.*)/ $2 $4/gmxs;
    s/(^3\s{6}allocate.*)/           $1/gmxs;
    s/(^4\s{6}allocate.*)/           $1/gmxs;
    s/(^5\s{6}allocate.*)/           $1/gmxs;
    s/(^\.SH\sDESCRIPTION\n)Unknown.*\.PP/$1/gmsx;
    print;
}
print "\n\.TP\nOther tools of GMAP suite are located in \/usr\/lib\/gmap";