diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-07 19:55:54 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-08 19:45:20 +0200 |
commit | bdfc4da5105c86f0dc63ed390da240306e6b4466 (patch) | |
tree | 12d79c21b0f4e0a9f166ebcb80b3207ecbef0660 /libtests/hex.cc | |
parent | 8d348974aa38001c74458b6e0a1709f8fce06743 (diff) | |
download | qpdf-bdfc4da5105c86f0dc63ed390da240306e6b4466.tar.zst |
Apply script across future v2 test files
There is one unexpected pass in this commit. This script was applied
to the files changed in this commit:
----------
#!/usr/bin/env python3
import json
import sys
def json_dumps(data):
return json.dumps(data, ensure_ascii=False,
indent=2, separators=(',', ': '))
for filename in sys.argv[1:]:
with open(filename, 'r') as f:
data = json.loads(f.read())
data['version'] = 2
objectinfo = {}
if 'objectinfo' in data:
objectinfo = data['objectinfo']
del data['objectinfo']
if 'objects' not in data:
continue
qpdf = {'jsonversion': 2, 'pdfversion': '1.3', 'objects': {}}
for k, v in data['objects'].items():
is_stream = objectinfo.get(k, {}).get('stream', {}).get('is', False)
if k.endswith(' R'):
k = 'obj:' + k
if is_stream:
v = {'stream': {'dict': v}}
else:
v = {'value': v}
qpdf['objects'][k] = v
data['qpdf'] = qpdf
del data['objects']
print(json_dumps(data))
----------
Diffstat (limited to 'libtests/hex.cc')
0 files changed, 0 insertions, 0 deletions