-
Notifications
You must be signed in to change notification settings - Fork 985
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
Merge default language data with section language data #2039
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's not the right way to do it. We should handle that before adding the default language struct in this line: https://github.com/getzola/zola/blob/next/components/config/src/config/mod.rs#L128
Thanks for the feedback! It seems clear for me how to proceed. Edit:
This one I'm a bit uncertain about though. Which part are you referring to that should be handled before adding the default language struct, @Keats? |
Fixing my broken logic, I went with a slightly more complicated route than I first imagined, in order to not do a merge unless necessary. If you think we should go with a simpler route, I propose something like this:
|
Just wanted to check whether you believe you'll have time to check out the updated PR any time soon, @Keats ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's ok I think. I'll change some style stuff later after merging but I think we should at least correcly test the errors before merging.
773d50b
to
5512f7a
Compare
@Keats, I've updated the test in question. I also took a second look at your test names and gave mine ones that are more in line with yours. I also changed some of the variable names in the new tests so they are more descriptive. |
Thanks! |
* Merge language data in config.toml
Resolves #1918
When there is a merge conflict, I went with causing a panic right away and not returning anything if everything went well, instead of
bail
at conflict and returning anOk()
if everything went well. If you want this changed to the latter approach, just let me know.I don't seem to be able to directly manipulate
languagesi[default_language]
, which is why I'm cloning it, manipulating it via.merge()
and then using.insert()
.The test
add_default_language_skips_insert()
doesn't check that insert actually hasn't been performed, it is only when running it manually that a person can check and see that a warning message hasn't been printed. I used it for my testing and left it, but we can remove it if you want to.Also, under method
add_default_language()
there was some TODO comments. This PR might solve it but I'm not sure, so I've left it.