Repository navigation
Improvement: dump shorthandtags - #187
rockitbaby wants to merge 2 commits into
Conversation
do not execute console.log when module is required and exports are used
|
Tag shorthanding is not an option as in your implementation. It's a core feature. However it quite more complicated, and your implementation looks like a dirty hack for me because in order to properly support tag shorthanding, we also must support other types of shorthanding and %TAG directive as well. Your implementation is probably valid, but I don't like the idea of merging this. So I'm leaving it up to @puzrin.
No. |
|
Ok. Let's close it as "not complete" |
|
thanks for reviewing.
Secondary Handles, Named Handles and Tag Prefixes and the %TAG directive are not reflected. Here is a quick test based on the TEST_SCHEMA. The dumped yaml is not as readable as the original input. 'use strict';
/*eslint-disable no-console*/
var yaml = require('../../');
var TEST_SCHEMA = require('../support/schema.js').TEST_SCHEMA;
var input = 'n: !tag2 100';
var result = yaml.load(input, { schema: TEST_SCHEMA });
var dump = yaml.dump(result, { schema: TEST_SCHEMA });
console.log(dump);
// 'n': !<!tag2> '100'Any ideas how to continue? How can I help improve the readability of dumper? |
|
Personally, i'm not big fun of custom types use. But if someone wish to improve, and that's doable without side-effects - no problem. The only major requirement is to avoid partial hacks and provide tests.
Sure. It worth to disuss first all noticeable core changes. That will help to avoid rewrites and will save your time. |
|
I'd not use term "readable" here. Shorthanded tags look a bit nicer, but they still require the reader to understand YAML. I think you misunderstood my point. I agree that support of shorthanded tags is definitely a wanted feature for the dumper, but it must be implemented properly. |
Sure, I think I got your point.
I'll try summarize the needs for a more readable / nicer looking dumper output as an issue |
|
Thanks for this library! There is a way to dump a custom type without this !< > Thanks again |
|
This is now implemented in a0d0caa (currently in Same algorithm as in Dumper still can't generate |
to create more human readble output
!pointinstead!<!point>for local tagshttp://www.yaml.org/spec/1.2/spec.html#tag/shorthand/
Are there any tests for the dumper, related to formatting and styling of output?