- Generate enabled action lines for standard.action.
[privoxy.git] / utils / filter2docs.pl
1 #!/usr/bin/perl -w
2
3 # $Id: filter2docs.pl,v 1.2 2006/07/18 14:49:14 david__schmidt Exp $
4 # $Source: /cvsroot/ijbswa/current/utils/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 <<DOCMARKUP;
24
25 Comment lines for default.action:
26
27 $comment_lines
28
29 Block of filter actions for standard.action:
30
31 $action_lines
32
33 SGML Source for AF chapter in U-M:
34
35 $sgml_source_1
36
37 SGML Source for AF Tutorial chapter in U-M
38
39 $sgml_source_2
40 DOCMARKUP