-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
yaml: Add references #117
yaml: Add references #117
Conversation
Hello. This seems pretty good, but I definitely need more tests to see what it really does. It's hard to tell as is. Many thanks in advance, |
just to make it clear: i'd really appreciate if you could fix the existing tests, but also add some new tests that explore the intended behavior of your code. Thx |
I have updated the existing tests and I believe they already explore the intended behavior of this change. |
thanks, that's in :) |
Hi @mquinson, Do you think |
Hello @l2dy. I was wondering whether More concerning is the fact that the reference is sometimes dupplicated:
Is it really the expected behavior? Thx |
YAML::Tiny doesn't preserve ordering, so we can't rely on filenames and line numbers which are mostly unique for each entry. But what happens if GNU gettext's xgettext(1) sees multiple identical strings on the same line? The references are deduplicated[1]! So IMHO, duplication is a problem shared across formats and deduplication shouldn't be done in the format modules. Now, I don't have the Perl skills required to implement deduplication, but I'd say that the yaml module can stay as is regarding this. Mini test case in [2] for anyone willing to implementing deduplication. [1]
[2]
Edit: multiple identical strings |
Ah, I think I got it. In my previous example, the string "Troubleshooting" appears in two differing contexts, that happen to have the same reference in the tree. Am I right? If so, we can definitely live with it. Thanks for your help. |
I'm not sure why this module treat hash keys as part of the type, but at least for arrays they share the same reference (YAML::Tiny doesn't preserve ordering). |
I just implemented the reference deduplication in po4a (my plane is in 3 hours, I'm bored), but this does not change anything in yaml example files. I'm thus suspecting that the problem is elsewhere. Not a big deal, but it's surprising, isn't it? |
No, it does. I'll make a PR soon. |
This PR adds references from the yaml hierarchy.
I'll fix the tests if it passes review.