-
Notifications
You must be signed in to change notification settings - Fork 991
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
Refactor and cleanup #1729
Comments
Hello, maybe you should also separate out the ash components in a separate library, so that they can be conveniently used in other projects. |
What do you mean by that? I don't really see what parts of Zola could be used in other projects |
For example, a component for processing markdown and parsing it can be used on the server, and markdown can be loaded from the database. Zola doesn't know how to do this but sometimes this behavior is necessary. |
Ah, I forgot to mention that publishing any part of Zola as a library is out of scope. You can still use the crate you want in your app if needed via a submodule or similar but it's never going to be on crates.io |
Ok first step done in #1747 which is getting most third parties imported from one sub crate instead of being repeated many times. The main issue is that sub-crates are too interdependent which suggests their scope is too big. Rebuilding one subcrate should not rebuild 4 seemingly unrelated sub crates. A few tasks:
And then go through every sub crate one by one to see what can be split/improved/is confusing. Also avoiding 7-8 arguments functions would be great. The rewrites should be geared towards making it easy to test. |
cc @mwcz if you want to pick up some of those early ones |
@Keats I took a shot at the |
I've got a branch with s/chrono/time mostly working. There are some tests failing but I hope to get it into shape soon. |
Cool, let's see if the weird hacks around TOML datetimes are still needed (utils/src/de.rs) |
The failing tests revealed that my branch was not, in fact, "mostly working". 😅 I'm working through the date parsing problems as time permits. So far I haven't found a way to make de.rs obsolete. |
I made some good progress tonight on s/chrono/time, and came away with a couple questions: Question 1: should datetimes include timezone offset? Zola predominantly uses chrono's NaiveDateTime, which don't include timezone offsets. The equivalent in the time crate is PrimitiveDateTime. Here, Zola converts from a DateTime (incl timezone) to NaiveDateTime (no timezone). zola/components/front_matter/src/page.rs Line 74 in 3dcc080
let dt = datetime!(2000-01-01 1:23:45 -5);
let dt_utc = dt.to_offset(offset!(UTC));
let prim = PrimitiveDateTime::new(dt_utc.date(), dt_utc.time());
assert_eq!(
prim,
PrimitiveDateTime::new(date!(2000 - 01 - 01), time!(6:23:45))
); Anyway, is it worth doing this in place of Question 2: how bad is adding For some reason,
But it works great when - use libs::time::macros::{format_description, time};
+ use time::macros::{format_description, time}; We don't have to use the macros, but it would be nice since they allow for compiling the format patterns at compile-time instead of run-time. |
Question 1: Question 2: |
Yeah, that's what Ahhh, I didn't know macros can't be re-exported. Interesting. 🌠 |
I'm taking the pulldown_cmark update + rendering test changes. Update: rendering test changes done, somehow a -1.5k LOC and a much more simple test setup |
Found on HN: https://diataxis.fr/ It would be a great way to rewrite the docs |
@Keats I'm ready to submit a PR for s/chrono/time. I had been rebasing it against the |
Yep, the commits from |
Cool, I'll get that in shortly. The rebase onto |
It's probably easier to cherry pick your commits (or squash them before) onto next, otherwise you end up dealing with irrelevant merge issues. |
It's all good. My local |
Has anyone got experience with Another thing to do in this release: add #1573 and solve https://zola.discourse.group/t/remove-lighter-heavier-and-earlier-later/767 |
I have no experience personally but I did hear this episode of Rustacean Station where Jane Lusby talks about error handling crates. Here's a link straight to the part where she talks about failure, anyhow, and eyre. https://pca.st/episode/e4d34171-e9cd-43ed-9819-fcbb2bcdcce2?t=949 The tldr seems to be:
|
#1816 for anyhow, it was faster than I thought and the resulting code is nicer. |
Zola has grown quite a bit since the last time it had a proper cleanup. It's time for another.
The focus should be on compilation speed and ease of testing. For compilation speed we can split into more sub-crates if needed as well as identify slow dependencies/issues, even if it's a bit annoying to repeat some deps in
Cargo.toml
...For ease of testing, right now the only way to setup a proper test is to add content to the kitchen sink
test_site
because there's no easy way to setup content and test it. #1480 is an example issue that should help with that. Overall it also needs more tests as new releases often breaks things, it would be nice to know about them before releasing.Also overall, it would be nice to know what's hard to understand about the codebase, where it's missing comments so we can improve on that.
The text was updated successfully, but these errors were encountered: