From: Fabian Keil Date: Sat, 2 Mar 2013 14:38:38 +0000 (+0000) Subject: Try to generate valid SGML X-Git-Tag: v_3_0_21~24 X-Git-Url: http://www.privoxy.org/gitweb/contact.html?a=commitdiff_plain;h=653b9f51a5a087bac0b608d16392711da57c5307;p=privoxy.git Try to generate valid SGML --- diff --git a/utils/filter2docs.pl b/utils/filter2docs.pl index cd8c8b4c..65d878ae 100755 --- a/utils/filter2docs.pl +++ b/utils/filter2docs.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# $Id: filter2docs.pl,v 1.6 2009/01/13 16:48:09 fabiankeil Exp $ +# $Id: filter2docs.pl,v 1.7 2013/03/02 14:38:20 fabiankeil Exp $ # $Source: /cvsroot/ijbswa/current/utils/filter2docs.pl,v $ # Parse the filter names and descriptions from a filter file and @@ -21,6 +21,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 +37,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"; }