Rearrange struct client_state to reduce memory on amd64
[privoxy.git] / utils / filter2docs.pl
index b80348c..1610f16 100755 (executable)
@@ -1,7 +1,6 @@
 #!/usr/bin/perl
 
 #!/usr/bin/perl
 
-# $Id: filter2docs.pl,v 1.5 2008/05/12 09:31:36 fabiankeil Exp $
-# $Source: /cvsroot/ijbswa/current/utils/filter2docs.pl,v $
+# utils/filter2docs.pl
 
 # Parse the filter names and descriptions from a filter file and
 # spit out copy&paste-ready markup for the various places in
 
 # Parse the filter names and descriptions from a filter file and
 # spit out copy&paste-ready markup for the various places in
@@ -15,12 +14,21 @@ my (%comment_lines, %action_lines, %sgml_source_1, %sgml_source_2);
 sub main() {
 
     die "Usage: $0 filter-file\n" unless (@ARGV == 1) ;
 sub main() {
 
     die "Usage: $0 filter-file\n" unless (@ARGV == 1) ;
-    open(INPUT, "< $ARGV[0]") or die "Coudln't open input file $ARGV[0] because $!\n";
+    open(INPUT, "< $ARGV[0]") or die "Couldn't open input file $ARGV[0]: $!\n";
 
     parse_file();
     print_markup();
 }
 
 
     parse_file();
     print_markup();
 }
 
+sub sgml_escape($) {
+    my $text = shift;
+
+    $text =~ s@<@&lt;@g;
+    $text =~ s@>@&gt;@g;
+
+    return $text;
+}
+
 sub parse_file() {
     while (<INPUT>) {
         if (/^((?:(?:SERVER|CLIENT)-HEADER-)?(?:FILTER|TAGGER)): ([-\w]+) (.*)$/) {
 sub parse_file() {
     while (<INPUT>) {
         if (/^((?:(?:SERVER|CLIENT)-HEADER-)?(?:FILTER|TAGGER)): ([-\w]+) (.*)$/) {
@@ -28,14 +36,14 @@ sub parse_file() {
             my $name = $2;
             my $description = $3;
             my $type = lc($type_uc);
             my $name = $2;
             my $description = $3;
             my $type = lc($type_uc);
-
+            my $sgml_description = sgml_escape($description);
             my $white_space = ' ' x (($type eq 'filter' ? 20 : 27) - length($name));
 
             $comment_lines{$type} .= "#     $name:" . $white_space . "$description\n";
             $action_lines{$type}  .= "+$type" . "{$name} \\\n";
             $sgml_source_1{$type} .= "   <para>\n    <anchor id=\"$type-$name\">\n" .
                 "    <screen>+$type" . "{$name}" . $white_space .
             my $white_space = ' ' x (($type eq 'filter' ? 20 : 27) - length($name));
 
             $comment_lines{$type} .= "#     $name:" . $white_space . "$description\n";
             $action_lines{$type}  .= "+$type" . "{$name} \\\n";
             $sgml_source_1{$type} .= "   <para>\n    <anchor id=\"$type-$name\">\n" .
                 "    <screen>+$type" . "{$name}" . $white_space .
-                "# $description</screen>\n   </para>\n";
+                "# $sgml_description</screen>\n   </para>\n";
             $sgml_source_2{$type} .= ' -<link linkend="' . $type_uc . "-" .
                 uc($name) . "\">$type" . "{$name}</link> \\\n";
         }
             $sgml_source_2{$type} .= ' -<link linkend="' . $type_uc . "-" .
                 uc($name) . "\">$type" . "{$name}</link> \\\n";
         }
@@ -62,10 +70,10 @@ sub print_markup() {
 
 Producing $type markup:
 
 
 Producing $type markup:
 
-Comment lines for default.action:
+Comment lines for default.action.master:
 
 $comment_lines{$type}
 
 $comment_lines{$type}
-Block of $type actions for default.action:
+Block of $type actions for default.action.master:
 
 $action_lines{$type}
 SGML Source for AF chapter in U-M:
 
 $action_lines{$type}
 SGML Source for AF chapter in U-M: