From c03d521b2c3704b02ca9eb69cfd50a851b40a9b6 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sat, 12 Aug 2023 20:24:18 +0200 Subject: [PATCH] fixed-newlines --- bin/sync-combine-two-yaml-exports-into-one.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/sync-combine-two-yaml-exports-into-one.pl b/bin/sync-combine-two-yaml-exports-into-one.pl index 6f4051a..4146d24 100755 --- a/bin/sync-combine-two-yaml-exports-into-one.pl +++ b/bin/sync-combine-two-yaml-exports-into-one.pl @@ -5,7 +5,15 @@ no strict "refs"; use IO::All; 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; my ($yf1, $yf2) = @ARGV; @@ -27,6 +35,8 @@ my $hash2 = &hashify($y2); # diff and recombine the two into a new one my $combinedhash = &hash2note(&diff($hash1, $hash2)); +#print Dumper($combinedhash); exit; + # turn into yaml my $combindedyaml = Dump($combinedhash);