diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2025-01-16 19:17:42 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2025-01-16 19:17:42 -0800 |
commit | 0708c9a12a1bc518046d9882b7d365b6c5626e76 (patch) | |
tree | aa416a1864c08b3a50232277b25cb811048a163e /stdlib | |
parent | 23adf30aa61e913b7cd221c9ecdf510d1a79d125 (diff) | |
download | txr-0708c9a12a1bc518046d9882b7d365b6c5626e76.tar.gz txr-0708c9a12a1bc518046d9882b7d365b6c5626e76.tar.bz2 txr-0708c9a12a1bc518046d9882b7d365b6c5626e76.zip |
json: flat must override all effects of :standard
* stream.h (struct json_opts): Member flat removed.
I noticed that !jo.flat was always being tested together
with jo.fmt == json_fmt_standard. Except for a few
places where the code only tested for json_fmt_standard,
resulting in flat output, but some extra spaces.
What distiguishes flat mode now is simply that we
disable stream indentation.
* lib.c (out_json_rec): Remove tests for !jo.flat.
(out_json): Remove initialization of jo.flat member.
In this function we set up indentation on the stream
resulting in multi-line mode (existing behavior).
(put_json): Remove initialization of jo.flat member.
If flat mode is requested, then it overrides the
format to json_fmt_default. I.e. json_fmt_standard
coresponding to :standard is only in effect if flat
is not requested.
In this function we set up indentation on the stream
if flat mode isn't requested, otherwise we disable
indentation (existing behavior, enough to make flat
work).
* tests/010/json.tl: Tests for flat mode, :standard
formatting, and combinaton of both.
Diffstat (limited to 'stdlib')
0 files changed, 0 insertions, 0 deletions