diff options
author | Tina Müller (tinita) <cpan2@tinita.de> | 2020-06-01 11:55:55 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-01 11:55:55 +0200 |
commit | 6e2fa9786ae20b670e77a72f1271d7574bc89f0f (patch) | |
tree | 273ccb8167e0e4dd7abe39c1291bea93a5ca9254 /src | |
parent | f41d3600d6497046b4532706b3729d049061d856 (diff) | |
download | libyaml-git-6e2fa9786ae20b670e77a72f1271d7574bc89f0f.tar.gz |
Emitter: Output space after an alias mapping key (#185)
Before:
a: &b x
*b: c
Now:
a: &b x
*b : c
Passing tests:
* 26DV: Whitespace around colon in mappings
* E76Z: Aliases in Implicit Block Mapping
* X38W: Aliases in Flow Objects
Test manually because `make test-suite` will overwrite changes in the skiplist:
./tests/run-parser-test-suite tests/run-test-suite/data/26DV/in.yaml | ./tests/run-emitter-test-suite
./tests/run-parser-test-suite tests/run-test-suite/data/E76Z/in.yaml | ./tests/run-emitter-test-suite
./tests/run-parser-test-suite tests/run-test-suite/data/X38W/in.yaml | ./tests/run-emitter-test-suite
Or edit tests/run-test-suite/test/blacklist/libyaml-emitter and do:
(cd tests/run-test-suite; prove -lv test)
Also I added some newlines to yaml.h to help identifying states by number.
Diffstat (limited to 'src')
-rw-r--r-- | src/emitter.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/emitter.c b/src/emitter.c index 7dd8331..656b3ad 100644 --- a/src/emitter.c +++ b/src/emitter.c @@ -1023,6 +1023,8 @@ yaml_emitter_emit_alias(yaml_emitter_t *emitter, SHIM(yaml_event_t *event)) { if (!yaml_emitter_process_anchor(emitter)) return 0; + if (emitter->simple_key_context) + if (!PUT(emitter, ' ')) return 0; emitter->state = POP(emitter, emitter->states); return 1; |