ea326ed85ce712ea8d87f5c3210f4b84f2c46049
[privoxy.git] / utils / filter2docs.pl
1 #!/usr/bin/perl -w
2
3 # $Id: filter2docs.pl,v 1.1.2.1 2003/03/16 15:32:44 oes Exp $
4 # $Source: /cvsroot/ijbswa/current/utils/Attic/filter2docs.pl,v $
5
6 # Parse the filter names and descriptions from a filter file and
7 # spit out copy&paste-ready markup for the various places in
8 # configuration and documentation where all filters are listed.
9
10 die "Usage: $0 filter-file\n" unless (@ARGV == 1) ;
11 open(INPUT, "< $ARGV[0]") or die "Coudln't open input file $ARGV[0] because $!\n";
12
13 while (<INPUT>) {
14   if (/^FILTER: ([-\w]+) (.*)$/) {
15     $comment_lines .= "#     $1:" . (" " x (20-length($1))) . "$2\n";
16     $action_lines  .= "-filter{$1} \\\n";
17     $sgml_source_1 .= "   <para>\n    <anchor id=\"filter-$1\">\n    <screen>+filter{$1}" .
18                       (" " x (20-length($1))) . "# $2</screen>\n   </para>\n";
19     $sgml_source_2 .= " -<link linkend=\"FILTER-" . uc($1) . "\">filter{$1}</link> \\\n";
20   }
21 }
22
23 print("Comment lines for default.action:\n\n$comment_lines\n\nBlock of filter actions for"
24      ." standard.action:\n\n$action_lines\n\nSGML Source for AF chapter in U-M:" .
25       "\n\n$sgml_source_1\n\nSGML Source for AF Tutorial chapter in U-M\n\n$sgml_source_2\n");