summaryrefslogtreecommitdiff
path: root/Master/tlpkg/TeXLive/TLConfFile.pm
diff options
context:
space:
mode:
authorNorbert Preining <preining@logic.at>2010-05-27 18:29:08 +0000
committerNorbert Preining <preining@logic.at>2010-05-27 18:29:08 +0000
commit83190675a8a72b94a0c34db8a26fa9628d6c04dc (patch)
treecc6bb002bc378ce862ac29d9409f13a1203ed87b /Master/tlpkg/TeXLive/TLConfFile.pm
parent4f0b0d226dabf0509c75d1d1b9b164308ecfcda4 (diff)
allow post comments and continuation lines (who would want to have that?)
git-svn-id: svn://tug.org/texlive/trunk@18534 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLConfFile.pm')
-rw-r--r--Master/tlpkg/TeXLive/TLConfFile.pm22
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;
}