diff options
Diffstat (limited to 'Master/tlpkg/TeXLive/TLConfFile.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLConfFile.pm | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Master/tlpkg/TeXLive/TLConfFile.pm b/Master/tlpkg/TeXLive/TLConfFile.pm index 13e6904595e..17233ca201f 100644 --- a/Master/tlpkg/TeXLive/TLConfFile.pm +++ b/Master/tlpkg/TeXLive/TLConfFile.pm @@ -40,19 +40,29 @@ sub reparse $self{'keyvalue'} = (); $self{'confdata'} = \%config; $self{'changed'} = 0; + my $in_postcomment = 0; for my $i (0..$config{'lines'}) { if ($config{$i}{'type'} eq 'comment') { $lastkey = undef; + $is_postcomment = 0; } elsif ($config{$i}{'type'} eq 'data') { $lastkey = $config{$i}{'key'}; $self{'keyvalue'}{$lastkey}{'value'} = $config{$i}{'value'}; $self{'keyvalue'}{$lastkey}{'line'} = $i; $self{'keyvalue'}{$lastkey}{'status'} = 'unchanged'; + if (defined($config{$i}{'postcomment'})) { + $in_postcomment = 1; + } else { + $in_postcomment = 0; + } } elsif ($config{$i}{'type'} eq 'empty') { $lastkey = undef; + $is_postcomment = 0; } elsif ($config{$i}{'type'} eq 'continuation') { if (defined($lastkey)) { - $self{'keyvalue'}{$lastkey}{'value'} .= $config{$i}{'value'}; + if (!$in_postcomment) { + $self{'keyvalue'}{$lastkey}{'value'} .= $config{$i}{'value'}; + } } # otherwise we are in a continuation of a comment!!! so nothing to do } else { @@ -179,7 +189,7 @@ sub save if (defined($config{$i}{'postcomment'})) { print $fhout $config{$i}{'postcomment'}; } - print $fhout "\n"; + print $fhout ($config{$i}{'multiline'} ? "\\\n" : "\n"); } else { print $fhout "$config{$i}{'original'}"; print $fhout ($config{$i}{'multiline'} ? "\\\n" : "\n"); @@ -289,7 +299,13 @@ sub parse_config_file { $config{$l}{'key'} = $1; $config{$l}{'value'} = $2; if (defined($3)) { - $config{$l}{'postcomment'} = $3; + my $postcomment = $3; + # check that there is actually a comment in the second part of the + # line. Otherwise we might add the continuation lines of that + # line to the value + if ($postcomment =~ m/$cc/) { + $config{$l}{'postcomment'} = $postcomment; + } } next; } |