X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=utils%2Ffilter2docs.pl;h=1610f16bf3dcf1a5d21a8bb33cb04addca44dd2b;hp=cd8c8b4c92cd6e1571f89e8ce53593e5b8650c47;hb=a5b4d31ab5ad2ed24cdb53ffa92679411b4176b0;hpb=ff77a36a5a8a7d92a90a2d9cf9f3cf27b0925132 diff --git a/utils/filter2docs.pl b/utils/filter2docs.pl index cd8c8b4c..1610f16b 100755 --- a/utils/filter2docs.pl +++ b/utils/filter2docs.pl @@ -1,7 +1,6 @@ #!/usr/bin/perl -# $Id: filter2docs.pl,v 1.6 2009/01/13 16:48:09 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 @@ -21,6 +20,15 @@ sub main() { print_markup(); } +sub sgml_escape($) { + my $text = shift; + + $text =~ s@<@<@g; + $text =~ s@>@>@g; + + return $text; +} + sub parse_file() { while () { 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 $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} .= " \n \n" . " +$type" . "{$name}" . $white_space . - "# $description\n \n"; + "# $sgml_description\n \n"; $sgml_source_2{$type} .= ' -$type" . "{$name} \\\n"; } @@ -62,10 +70,10 @@ sub print_markup() { Producing $type markup: -Comment lines for default.action: +Comment lines for default.action.master: $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: