diff options
author | Norbert Preining <preining@logic.at> | 2017-10-27 05:26:10 +0000 |
---|---|---|
committer | Norbert Preining <preining@logic.at> | 2017-10-27 05:26:10 +0000 |
commit | 0bd7e97c405a4efd80b8e304486b4d35825c277c (patch) | |
tree | beeee0027651ed1eeac28a6cdd0410d5d7ac4451 /Master/tlpkg/TeXLive/TLPOBJ.pm | |
parent | bd41846f4f09f09f3bcc3efa0f49795a63461035 (diff) |
update JSON format, add documentation on formats
git-svn-id: svn://tug.org/texlive/trunk@45620 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tlpkg/TeXLive/TLPOBJ.pm')
-rw-r--r-- | Master/tlpkg/TeXLive/TLPOBJ.pm | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/Master/tlpkg/TeXLive/TLPOBJ.pm b/Master/tlpkg/TeXLive/TLPOBJ.pm index 6ff4908c0f8..0ca7ebb6d19 100644 --- a/Master/tlpkg/TeXLive/TLPOBJ.pm +++ b/Master/tlpkg/TeXLive/TLPOBJ.pm @@ -450,7 +450,25 @@ sub as_json { $foo{'relocated'} = $JSON::false; } } - my $utf8_encoded_json_text = JSON::encode_json(\%foo); # $json->encode(\%foo); + # adjust the docfiles entry to the specification in JSON-formats + my @docf = $self->docfiles; + my $dfd = $self->docfiledata; + my @newdocf; + for my $f ($self->docfiles) { + my %newd; + $newd{'file'} = $f; + if (defined($dfd->{$f})) { + # TODO should we check that there are actually only "details" + # and "language" as key? + for my $k (keys %{$dfd->{$f}}) { + $newd{$k} = $dfd->{$f}->{$k}; + } + } + push @newdocf, \%newd; + } + $foo{'docfiles'} = [ @newdocf ]; + delete($foo{'docfiledata'}); + my $utf8_encoded_json_text = JSON::encode_json(\%foo); return $utf8_encoded_json_text; } |