X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=utils%2Fprepare-configfile.pl;h=dc68632b82c2006033cc10bd767f16afa69b96c8;hp=4cb8d5af8f29cd41c05c9931b4e02e978b800106;hb=e52674334610f4c2a1eb22b095c126527705f314;hpb=3c1f116b24ec7d180e28f4a4ab1c72d75d8f95f4;ds=sidebyside diff --git a/utils/prepare-configfile.pl b/utils/prepare-configfile.pl index 4cb8d5af..dc68632b 100755 --- a/utils/prepare-configfile.pl +++ b/utils/prepare-configfile.pl @@ -31,7 +31,10 @@ sub main() { s/^1\. \@\@TITLE\@\@/ /i; - if (m/^(\d\.)(\d\.)(\d\.)?\s/) { + if ($hit_header) { + $header_len += length($_); + $_ = " " . $_; + } elsif (m/^(\d*\.){1,3}\s/) { # Remove the first digit as it's the # config file section in the User Manual. s/^(\d\.)//; @@ -42,18 +45,23 @@ sub main() { # Remember to underline it. $hit_header = 1; $header_len = length($_); - - # Separate it from the previous section. - print "#\n"; } if ($unfold_mode) { s/^\s+/ /; $unfold_mode = 0; } else { + if ( $hit_option ) { + # processing a continuation of a @@ line + if ( /^\s*$/ ) { # blank line + $hit_option = 0; + next; + } + } s/^/# /; } - if ($unfolding_enabled and m/(\s+#)\s*$/) { + if ($unfolding_enabled and + (m/(\s+#)\s*$/ or m/forward-socks5 and$/)) { $unfold_mode = 1; chomp; } @@ -61,8 +69,6 @@ sub main() { # XXX: someone should figure out what this stuff # is supposed to do (and if it really does that). s/^# #/####/ if /^# #{12,}/; - s/^.*$// if $hit_option; - $hit_option = 0; s/^\n//; s/^#\s*-{20,}//; s/ *$//; @@ -75,12 +81,13 @@ sub main() { print unless (/^\s*$/); - if ($hit_header) { + if ($hit_header and !$unfold_mode) { # The previous line was a section # header so we better underline it. die "Invalid header length" unless defined $header_len; print "# " . "=" x $header_len . "\n"; $hit_header = 0; + $header_len = 0; }; } }