fixed-newlines

This commit is contained in:
2023-08-12 20:24:18 +02:00
parent 53c16708fe
commit c03d521b2c

View File

@@ -5,7 +5,15 @@ no strict "refs";
use IO::All; use IO::All;
use Encode; use Encode;
use YAML::XS qw(Load Dump); # only YAML::XS is able to properly load our data (others fail
# invariably)
use YAML::XS qw(Load);
# only YAML is able to properly Dump the data YAML::XS generates
# various kinds of multiline entries like "line\nline2\nline3" end up
# literally in the generated yaml, which note is then unable to
# feed. So, the pure perl version is better as it always generates
# multiline entries for data containing newlines
use YAML qw(Dump);
use Data::Dumper; use Data::Dumper;
my ($yf1, $yf2) = @ARGV; my ($yf1, $yf2) = @ARGV;
@@ -27,6 +35,8 @@ my $hash2 = &hashify($y2);
# diff and recombine the two into a new one # diff and recombine the two into a new one
my $combinedhash = &hash2note(&diff($hash1, $hash2)); my $combinedhash = &hash2note(&diff($hash1, $hash2));
#print Dumper($combinedhash); exit;
# turn into yaml # turn into yaml
my $combindedyaml = Dump($combinedhash); my $combindedyaml = Dump($combinedhash);